00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 #ifndef qhDEFgeom
00013 #define qhDEFgeom 1
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 #define fabs_( a ) ((( a ) < 0 ) ? -( a ):( a ))
00024                
00025 
00026 
00027 
00028 
00029 
00030 
00031 #define fmax_( a,b )  ( ( a ) < ( b ) ? ( b ) : ( a ) )
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 #define fmin_( a,b )  ( ( a ) > ( b ) ? ( b ) : ( a ) )
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 #define maximize_( maxval, val ) {if (( maxval ) < ( val )) ( maxval )= ( val );}
00048 
00049 
00050 
00051 
00052 
00053 
00054 
00055 #define minimize_( minval, val ) {if (( minval ) > ( val )) ( minval )= ( val );}
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 #define det2_( a1,a2,b1,b2 ) (( a1 )*( b2 ) - ( a2 )*( b1 ))
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 
00075 
00076 #define det3_( a1,a2,a3,b1,b2,b3,c1,c2,c3 ) ( ( a1 )*det2_( b2,b3,c2,c3 ) \
00077                 - ( b1 )*det2_( a2,a3,c2,c3 ) + ( c1 )*det2_( a2,a3,b2,b3 ) )
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 
00087 
00088 
00089 
00090 #define dX( p1,p2 )  ( *( rows[p1] ) - *( rows[p2] ))
00091 #define dY( p1,p2 )  ( *( rows[p1]+1 ) - *( rows[p2]+1 ))
00092 #define dZ( p1,p2 )  ( *( rows[p1]+2 ) - *( rows[p2]+2 ))
00093 #define dW( p1,p2 )  ( *( rows[p1]+3 ) - *( rows[p2]+3 ))
00094 
00095 
00096 
00097 void    qh_backnormal (realT **rows, int numrow, int numcol, boolT sign, coordT *normal, boolT *nearzero);
00098 void    qh_distplane (pointT *point, facetT *facet, realT *dist);
00099 facetT *qh_findbest (pointT *point, facetT *startfacet,
00100                      boolT bestoutside, boolT newfacets, boolT noupper,
00101                      realT *dist, boolT *isoutside, int *numpart);
00102 facetT *qh_findbestnew (pointT *point, facetT *startfacet,
00103            realT *dist, boolT *isoutside, int *numpart);
00104 void    qh_gausselim(realT **rows, int numrow, int numcol, boolT *sign, boolT *nearzero);
00105 realT   qh_getangle(pointT *vect1, pointT *vect2);
00106 pointT *qh_getcenter(setT *vertices);
00107 pointT *qh_getcentrum(facetT *facet);
00108 realT   qh_getdistance(facetT *facet, facetT *neighbor, realT *mindist, realT *maxdist);
00109 void    qh_normalize (coordT *normal, int dim, boolT toporient);
00110 void    qh_normalize2 (coordT *normal, int dim, boolT toporient, 
00111             realT *minnorm, boolT *ismin);
00112 pointT *qh_projectpoint(pointT *point, facetT *facet, realT dist);
00113 
00114 void    qh_setfacetplane(facetT *newfacets);
00115 void    qh_sethyperplane_det (int dim, coordT **rows, coordT *point0, 
00116               boolT toporient, coordT *normal, realT *offset, boolT *nearzero);
00117 void    qh_sethyperplane_gauss (int dim, coordT **rows, pointT *point0, 
00118              boolT toporient, coordT *normal, coordT *offset, boolT *nearzero);
00119 
00120 
00121 
00122 
00123 coordT *qh_copypoints (coordT *points, int numpoints, int dimension);
00124 void    qh_crossproduct (int dim, realT vecA[3], realT vecB[3], realT vecC[3]);
00125 realT   qh_determinant (realT **rows, int dim, boolT *nearzero);
00126 realT   qh_detjoggle (pointT *points, int numpoints, int dimension);
00127 void    qh_detroundoff (void);
00128 realT   qh_detsimplex(pointT *apex, setT *points, int dim, boolT *nearzero);
00129 realT   qh_distnorm (int dim, pointT *point, pointT *normal, realT *offsetp);
00130 realT   qh_distround (int dimension, realT maxabs, realT maxsumabs);
00131 realT   qh_divzero(realT numer, realT denom, realT mindenom1, boolT *zerodiv);
00132 realT   qh_facetarea (facetT *facet);
00133 realT   qh_facetarea_simplex (int dim, coordT *apex, setT *vertices, 
00134           vertexT *notvertex,  boolT toporient, coordT *normal, realT *offset);
00135 pointT *qh_facetcenter (setT *vertices);
00136 boolT   qh_findbestsharp (pointT *point, facetT **bestfacet, 
00137            realT *bestdist, int *numpart);
00138 facetT *qh_findgooddist (pointT *point, facetT *facetA, realT *distp, facetT **facetlist);
00139 void    qh_getarea (facetT *facetlist);
00140 boolT   qh_gram_schmidt(int dim, realT **rows);
00141 boolT   qh_inthresholds (coordT *normal, realT *angle);
00142 void    qh_joggleinput (void);
00143 realT  *qh_maxabsval (realT *normal, int dim);
00144 setT   *qh_maxmin(pointT *points, int numpoints, int dimension);
00145 realT   qh_maxouter (void);
00146 void    qh_maxsimplex (int dim, setT *maxpoints, pointT *points, int numpoints, setT **simplex);
00147 realT   qh_minabsval (realT *normal, int dim);
00148 int     qh_mindiff (realT *vecA, realT *vecB, int dim);
00149 boolT   qh_orientoutside (facetT *facet);
00150 void    qh_outerinner (facetT *facet, realT *outerplane, realT *innerplane);
00151 coordT  qh_pointdist(pointT *point1, pointT *point2, int dim);
00152 void    qh_printmatrix (FILE *fp, char *string, realT **rows, int numrow, int numcol);
00153 void    qh_printpoints (FILE *fp, char *string, setT *points);
00154 void    qh_projectinput (void);
00155 void    qh_projectpoints (signed char *project, int n, realT *points, 
00156              int numpoints, int dim, realT *newpoints, int newdim);
00157 int     qh_rand( void);
00158 void    qh_srand( int seed);
00159 realT   qh_randomfactor (void);
00160 void    qh_randommatrix (realT *buffer, int dim, realT **row);
00161 void    qh_rotateinput (realT **rows);
00162 void    qh_rotatepoints (realT *points, int numpoints, int dim, realT **rows);
00163 void    qh_scaleinput (void);
00164 void    qh_scalelast (coordT *points, int numpoints, int dim, coordT low,
00165                    coordT high, coordT newhigh);
00166 void    qh_scalepoints (pointT *points, int numpoints, int dim,
00167                 realT *newlows, realT *newhighs);
00168 boolT   qh_sethalfspace (int dim, coordT *coords, coordT **nextp, 
00169               coordT *normal, coordT *offset, coordT *feasible);
00170 coordT *qh_sethalfspace_all (int dim, int count, coordT *halfspaces, pointT *feasible);
00171 pointT *qh_voronoi_center (int dim, setT *points);
00172 
00173 #endif 
00174 
00175 
00176