---------------------------------
geom.h
header file for geometric routines
see qh-geom.htm and geom.c
copyright (c) 1993-2003 The Geometry Center
*/
#ifndef qhDEFgeom
#define qhDEFgeom 1
/* ============ -macros- ======================== */
/*----------------------------------
fabs_(a)
returns the absolute value of a
*/
#define fabs_( a ) ((( a ) < 0 ) ? -( a ):( a ))
/*----------------------------------
fmax_(a,b)
returns the maximum value of a and b
*/
#define fmax_( a,b ) ( ( a ) < ( b ) ? ( b ) : ( a ) )
/*----------------------------------
fmin_(a,b)
returns the minimum value of a and b
*/
#define fmin_( a,b ) ( ( a ) > ( b ) ? ( b ) : ( a ) )
/*----------------------------------
maximize_(maxval, val)
set maxval to val if val is greater than maxval
*/
#define maximize_( maxval, val ) {if (( maxval ) < ( val )) ( maxval )= ( val );}
/*----------------------------------
minimize_(minval, val)
set minval to val if val is less than minval
*/
#define minimize_( minval, val ) {if (( minval ) > ( val )) ( minval )= ( val );}
/*----------------------------------
det2_(a1, a2,
b1, b2)
compute a 2-d determinate
*/
#define det2_( a1,a2,b1,b2 ) (( a1 )*( b2 ) - ( a2 )*( b1 ))
/*----------------------------------
det3_(a1, a2, a3,
b1, b2, b3,
c1, c2, c3)
compute a 3-d determinate
*/
#define det3_( a1,a2,a3,b1,b2,b3,c1,c2,c3 ) ( ( a1 )*det2_( b2,b3,c2,c3 ) \
- ( b1 )*det2_( a2,a3,c2,c3 ) + ( c1 )*det2_( a2,a3,b2,b3 ) )
/*----------------------------------
dX( p1, p2 )
dY( p1, p2 )
dZ( p1, p2 )
given two indices into rows[],
compute the difference between X, Y, or Z coordinates
*/
#define dX( p1,p2 ) ( *( rows[p1] ) - *( rows[p2] ))
#define dY( p1,p2 ) ( *( rows[p1]+1 ) - *( rows[p2]+1 ))
#define dZ( p1,p2 ) ( *( rows[p1]+2 ) - *( rows[p2]+2 ))
#define dW( p1,p2 ) ( *( rows[p1]+3 ) - *( rows[p2]+3 ))
/*============= prototypes in alphabetical order, infrequent at end ======= */
void qh_backnormal (realT **rows, int numrow, int numcol, boolT sign, coordT *normal, boolT *nearzero);
void qh_distplane (pointT *point, facetT *facet, realT *dist);
facetT *qh_findbest (pointT *point, facetT *startfacet,
boolT bestoutside, boolT isnewfacets, boolT noupper,
realT *dist, boolT *isoutside, int *numpart);
facetT *qh_findbesthorizon (boolT ischeckmax, pointT *point,
facetT *startfacet, boolT noupper, realT *bestdist, int *numpart);
facetT *qh_findbestnew (pointT *point, facetT *startfacet, realT *dist,
boolT bestoutside, boolT *isoutside, int *numpart);
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, int numrow, int numcol, boolT '
void qh_gausselim(realT **rows, i