ut_uti.c File Reference


Detailed Description

utilities: Integer UTI_ doubles UTP_

=====================================================
Liste_Funktionen_Beginn:

--------- Addresses (Pointers)
UTA_reallTab              reallocate a table of pointers       UNFERTIG !

--------- integers
IMAX                      INLINE
IMIN                      INLINE
IABS                      INLINE
ISIGN                     sign of int; +1 or -1                          INLINE
ICHAR                     int  < char                                    INLINE
ICHG01                    change 0 -> 1, 1 -> 0.                         INLINE
UTI_deleq                 delete equal records form 2 intLists
UTI_findeq                find 2 gleiche Elemente in 2 IntegerListen
UTI_ni_sort               sort integerList
UTI_iNr_chrNr             give nr of ints for n characters (not including \0) INL
UTI_div4up                change nr to modulo(4)=0; increase (1|2|3|4 -> 4)
UTI_round_i2b             round integer to byte (back: UTI_round_b2i)
UTI_round_b2i             make integer from byte (back from UTI_round_i2b)

--------- doubles;  see also UT1D_
DMAX                      INLINE
DMIN                      INLINE
DSIGN                     sign of double; +1 or -1                       INLINE
DSIGTOL                   sign of double with tolerance; +1 or -1        INLINE
DLIM2                     limits double between hi and lo-value
ACOS                      cos                                            INLINE
UTP_comp_0                compare double (double == 0.0 + - UT_TOL_min1) INLINE
UTP_compdb0               compare double mit 0.0 mit Tol.
UTP_comp2db               compare 2 doubles (with tolerance)             INLINE
UTP_comp2x2db             compare 2 * 2 doubles (with tolerance)
UTP_min                   find minimum double out of dbTab
UTP_dbRec_min             find minimum double out of dbRecords
UTP_dbRec_max             find maximum double out of dbRecords
UTP_max                   find minimum double out of dbTab
UTP_db_cknear_2db         find nearest double out of 2 doubles
UTP_db_cknear_ndb         find nearest double out of dbTab
UTP_db_ck_in2db           test if value of v is between v1 / v2
UTP_db_ck_in2dbTol        test if value of v is between v1 / v2
UTP_2db_ck_in4db          die beiden inneren Werte aus 4 Zahlen finden

UTP_param_p0p1px          Parameterwert von Zahl (Parameterwerte fuer 0 u 1)
UTP_px_paramp0p1px        Zahl aus p0, p1 und Parameterwert         INLINE

UTP_db_rnd1sig            Zahl auf 1 signifikante Stelle runden
UTP_db_rnd2sig            Zahl auf 2 signifikante Stellen runden
UTP_db_rnd10              round dound double to next 10
UTP_db_rnd5               round dound double to next 5
UTP_dbsiz                 get size of double; (number of pos. digits);

UTP_sincosTab_circ        sinus- und cosinuswerte fuer einen Vollkreis.

--------- binary
BIT_SET                   einzelne Bits setzen in einem int         INLINE
BIT_CLR                   einzelne Bits loeschen in einem int       INLINE
BIT_GET                   einzelne Bits filtern in einem int        INLINE

UTI_dump__                disp. hex

Liste_Funktionen_Ende:
=====================================================

#include "../xa/MS_Def0.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "../ut/ut_geo.h"

Functions

int UTP_param_p0p1px (double *parx, double p0, double p1, double px)
 ======================================================================
int UTA_reallTab (char **startAdr, int offset, int recNr, char *oldAdr, char *newAdr)
 ================================================================
int UTI_dump__ (void *pv, int oSiz)
 ================================================================
int UTI_deleq (int *i1Nr, int *i1Tab, int *i2Nr, int *i2Tab)
 ======================================================================
int UTI_ni_sort (int *iTab, int iNr)
 ================================================================
int UTI_findeq (int *if1, int *if2, int *iTab1, int iNr1, int *iTab2, int iNr2)
 ================================================================
int UTI_div4up (int ii)
 ================================================================
int UTI_round_i2b (int i1)
 ================================================================
int UTI_round_b2i (int i1)
 ================================================================
int UTP_compdb0 (double db, double tol)
 ======================================================================
int UTP_db_ck_in2db (double v, double v1, double v2)
 ======================================================================
int UTP_db_ck_in2dbTol (double v, double v1, double v2, double tol)
 ======================================================================
int UTP_2db_ck_in4db (int *ii1, int *ii2, double *dbTab)
 ================================================================
double UTP_db_rnd1sig (double d1)
double UTP_db_rnd2sig (double d1)
int UTP_db_rnd10 (double d1)
 ================================================================
int UTP_db_rnd5 (double d1)
 ================================================================
int UTP_dbsiz (int *i5, double d1)
 ================================================================
int UTP_db_cknear_2db (double *db, double *d1, double *d2)
 =======================================================================
int UTP_db_cknear_ndb (double db1, int dbNr, double *dbTab)
 =======================================================================
int UTP_comp2x2db (double d11, double d12, double d21, double d22, double tol)
 ================================================================
int UTP_min (int dbNr, double *dbTab)
 ================================================================
int UTP_dbRec_min (int dbNr, double *dTab, int recSiz)
 ================================================================
int UTP_dbRec_max (int dbNr, double *dTab, int recSiz)
 ================================================================
int UTP_max (int dbNr, double *dbTab)
 ================================================================
int UTP_sincosTab_circ (double *sa, double *ca, int dNr)
 ================================================================


Function Documentation

int UTP_param_p0p1px ( double *  parx,
double  p0,
double  p1,
double  px 
)

======================================================================

====================================================================== UTP_param_p0p1px Parameterwert von Zahl (ex parameterwerte fuer 0 u 1) Input: p0 - der Zahlenwert beim Parameterwert 0. p1 - der Zahlenwert beim Parameterwert 1. px - ein Zahlenwert, von dem der Parameterwert gesucht ist. Output: parx der Parameterwert von px. retCod 0 = OK; -1 = Error (p0==p1) see also UTP_px_paramp0p1px Beispiel: p0=5.; p1=10.; px=7.5; parx = 0.5 p0=0.; p1=-1.; px=0.5; parx = -0.5

int UTA_reallTab ( char **  startAdr,
int  offset,
int  recNr,
char *  oldAdr,
char *  newAdr 
)

================================================================

================================================================ reallocate a table of pointers startAdr is the first address to be moved. offset is the distance to the next adress (the recordsize)

int UTI_dump__ ( void *  pv,
int  oSiz 
)

================================================================

================================================================

int UTI_deleq ( int *  i1Nr,
int *  i1Tab,
int *  i2Nr,
int *  i2Tab 
)

======================================================================

====================================================================== delete equal records form 2 intLists

int UTI_ni_sort ( int *  iTab,
int  iNr 
)

================================================================

================================================================ int-tabelle sortieren

int UTI_findeq ( int *  if1,
int *  if2,
int *  iTab1,
int  iNr1,
int *  iTab2,
int  iNr2 
)

================================================================

================================================================ find 2 gleiche Elemente in den Listen iTab1 / iTab1 if1, if2 Indices der gleichen Elemente RetCode: 0 gleiche Elemente gefunden; Indices out in if1, if2 -1 keine gleichen Elemente gefunden.

int UTI_div4up ( int  ii  ) 

================================================================

================================================================ UTI_div4up change nr to modulo(4)=0; increase (1|2|3|4 -> 4)

int UTI_round_i2b ( int  i1  ) 

================================================================

================================================================ UTI_round_i2b round integer to byte (back: UTI_round_b2i) Purpose: save Integers in a single byte. UTI_round_i2b(10000) -> 14 UTI_round_b2i(14) -> 16384

int UTI_round_b2i ( int  i1  ) 

================================================================

================================================================ UTI_round_b2i make integer from byte (back from UTI_round_i2b)

int UTP_compdb0 ( double  db,
double  tol 
)

======================================================================

====================================================================== UTP_compdb0 compare double mit 0.0 mit Tol.

Retcode 0: db <> 0.0 (gr. oder kl. tol) 1: db = 0.0 (innerhalb tol)

int UTP_db_ck_in2db ( double  v,
double  v1,
double  v2 
)

======================================================================

====================================================================== test if value of v is between v1 / v2 RC = 0: YES, v is between v1 / v2 RC = 1: NO, v is outside near v1; v2 > v1. RC = 2: NO, v is outside near v2; v2 > v1. RC = -1: NO, v is outside near v1; v2 < v1. RC = -2: NO, v is outside near v2; v2 < v1.

int UTP_db_ck_in2dbTol ( double  v,
double  v1,
double  v2,
double  tol 
)

======================================================================

====================================================================== test if value of v is between v1 / v2 RC = 0: YES, v is between v1 / v2 RC = 1: NO, v is outside v1 / v2

int UTP_2db_ck_in4db ( int *  ii1,
int *  ii2,
double *  dbTab 
)

================================================================

================================================================ UTP_2db_ck_in4db die beiden inneren Werte aus 4 Zahlen finden

double UTP_db_rnd1sig ( double  d1  ) 

double UTP_db_rnd2sig ( double  d1  ) 

int UTP_db_rnd10 ( double  d1  ) 

================================================================

================================================================ UTP_db_rnd10 2 gives 10 40 gives 100 777 gives 1000

int UTP_db_rnd5 ( double  d1  ) 

================================================================

================================================================ UTP_db_rnd10 2 gives 5 7 gives 10 40 gives 50 77 gives 100 777 gives 1000

int UTP_dbsiz ( int *  i5,
double  d1 
)

================================================================

================================================================ UTP_dbsiz get size of double; (number of pos. digits); 5 gives 1, 12 gives 2 ... i5 gives if d1 is over(+1) or under(-1) 5. d1=22 gives i5=-1; d1=777 gives i5=+1;

int UTP_db_cknear_2db ( double *  db,
double *  d1,
double *  d2 
)

=======================================================================

======================================================================= UTP_db_cknear_2db find nearest double out of 2 doubles RetCod 0 = db-d1 ist smaller than db-d2 RetCod 1 = db-d2 ist smaller than db-d1

int UTP_db_cknear_ndb ( double  db1,
int  dbNr,
double *  dbTab 
)

=======================================================================

======================================================================= UTP_db_cknear_ndb find nearest double out of dbTab

int UTP_comp2x2db ( double  d11,
double  d12,
double  d21,
double  d22,
double  tol 
)

================================================================

================================================================ UTP_comp2x2db compare 2 * 2 doubles (with tolerance) 2 * 2 Zahlen vergleichen; gleich=0; verkehrt=1; else=-1. RetCod: 0 d11 == d21; d12 == d22; beide Paare gleich. 1 d11 == d22; d12 == d21; beide Paare gleich, aber verkehrt. -1 d11 == d21; d21 != d22; -2 d11 == d22; d12 != d21 ACHTUNG: d12 == d22 wird nicht getestet ! -3 beide Paare ungleich.

int UTP_min ( int  dbNr,
double *  dbTab 
)

================================================================

================================================================ UTP_min find minimum double out of dbTab returns index of min. double.

int UTP_dbRec_min ( int  dbNr,
double *  dTab,
int  recSiz 
)

================================================================

================================================================ UTP_dbRec_min find minimum double out of dbRecords dbNr records of size recSiz; first obj is a double; find index of min

int UTP_dbRec_max ( int  dbNr,
double *  dTab,
int  recSiz 
)

================================================================

================================================================ UTP_dbRec_max find maximum double out of dbRecords dbNr records of size recSiz; first obj is a double; find index of min

int UTP_max ( int  dbNr,
double *  dbTab 
)

================================================================

================================================================ UTP_min find minimum double out of dbTab

int UTP_sincosTab_circ ( double *  sa,
double *  ca,
int  dNr 
)

================================================================

================================================================ die sinus- und cosinuswerte fuer einen Vollkreis. insgesamt dNr Werte; erster und letzter sind gleich. sa = sin-Tabelle; ca = cos-Tabelle

xxxx | xxx | x | r / | x | / | x | / sin x --x-------|---x------------- cos x


Generated on Sat May 30 09:31:56 2009 for gCAD3D by  doxygen 1.5.6