geom.h
Go to the documentation of this file.
00001 /*<html><pre>  -<a                             href="qh-geom.htm"
00002   >-------------------------------</a><a name="TOP">-</a>
00003 
00004   geom.h
00005     header file for geometric routines
00006 
00007    see qh-geom.htm and geom.c
00008 
00009    Copyright (c) 1993-2011 The Geometry Center.
00010    $Id: //main/2011/qhull/src/libqhull/geom.h#2 $$Change: 1342 $
00011    $DateTime: 2011/03/07 21:55:47 $$Author: bbarber $
00012 */
00013 
00014 #ifndef qhDEFgeom
00015 #define qhDEFgeom 1
00016 
00017 #include "libqhull.h"
00018 
00019 /* ============ -macros- ======================== */
00020 
00021 /*-<a                             href="qh-geom.htm#TOC"
00022   >--------------------------------</a><a name="fabs_">-</a>
00023 
00024   fabs_(a)
00025     returns the absolute value of a
00026 */
00027 #define fabs_( a ) ((( a ) < 0 ) ? -( a ):( a ))
00028 
00029 /*-<a                             href="qh-geom.htm#TOC"
00030   >--------------------------------</a><a name="fmax_">-</a>
00031 
00032   fmax_(a,b)
00033     returns the maximum value of a and b
00034 */
00035 #define fmax_( a,b )  ( ( a ) < ( b ) ? ( b ) : ( a ) )
00036 
00037 /*-<a                             href="qh-geom.htm#TOC"
00038   >--------------------------------</a><a name="fmin_">-</a>
00039 
00040   fmin_(a,b)
00041     returns the minimum value of a and b
00042 */
00043 #define fmin_( a,b )  ( ( a ) > ( b ) ? ( b ) : ( a ) )
00044 
00045 /*-<a                             href="qh-geom.htm#TOC"
00046   >--------------------------------</a><a name="maximize_">-</a>
00047 
00048   maximize_(maxval, val)
00049     set maxval to val if val is greater than maxval
00050 */
00051 #define maximize_( maxval, val ) { if (( maxval ) < ( val )) ( maxval )= ( val ); }
00052 
00053 /*-<a                             href="qh-geom.htm#TOC"
00054   >--------------------------------</a><a name="minimize_">-</a>
00055 
00056   minimize_(minval, val)
00057     set minval to val if val is less than minval
00058 */
00059 #define minimize_( minval, val ) { if (( minval ) > ( val )) ( minval )= ( val ); }
00060 
00061 /*-<a                             href="qh-geom.htm#TOC"
00062   >--------------------------------</a><a name="det2_">-</a>
00063 
00064   det2_(a1, a2,
00065         b1, b2)
00066 
00067     compute a 2-d determinate
00068 */
00069 #define det2_( a1,a2,b1,b2 ) (( a1 )*( b2 ) - ( a2 )*( b1 ))
00070 
00071 /*-<a                             href="qh-geom.htm#TOC"
00072   >--------------------------------</a><a name="det3_">-</a>
00073 
00074   det3_(a1, a2, a3,
00075        b1, b2, b3,
00076        c1, c2, c3)
00077 
00078     compute a 3-d determinate
00079 */
00080 #define det3_( a1,a2,a3,b1,b2,b3,c1,c2,c3 ) ( ( a1 )*det2_( b2,b3,c2,c3 ) \
00081                 - ( b1 )*det2_( a2,a3,c2,c3 ) + ( c1 )*det2_( a2,a3,b2,b3 ) )
00082 
00083 /*-<a                             href="qh-geom.htm#TOC"
00084   >--------------------------------</a><a name="dX">-</a>
00085 
00086   dX( p1, p2 )
00087   dY( p1, p2 )
00088   dZ( p1, p2 )
00089 
00090     given two indices into rows[],
00091 
00092     compute the difference between X, Y, or Z coordinates
00093 */
00094 #define dX( p1,p2 )  ( *( rows[p1] ) - *( rows[p2] ))
00095 #define dY( p1,p2 )  ( *( rows[p1]+1 ) - *( rows[p2]+1 ))
00096 #define dZ( p1,p2 )  ( *( rows[p1]+2 ) - *( rows[p2]+2 ))
00097 #define dW( p1,p2 )  ( *( rows[p1]+3 ) - *( rows[p2]+3 ))
00098 
00099 /*============= prototypes in alphabetical order, infrequent at end ======= */
00100 
00101 void    qh_backnormal(realT **rows, int numrow, int numcol, boolT sign, coordT *normal, boolT *nearzero);
00102 void    qh_distplane(pointT *point, facetT *facet, realT *dist);
00103 facetT *qh_findbest(pointT *point, facetT *startfacet,
00104                      boolT bestoutside, boolT isnewfacets, boolT noupper,
00105                      realT *dist, boolT *isoutside, int *numpart);
00106 facetT *qh_findbesthorizon(boolT ischeckmax, pointT *point,
00107                      facetT *startfacet, boolT noupper, realT *bestdist, int *numpart);
00108 facetT *qh_findbestnew(pointT *point, facetT *startfacet, realT *dist,
00109                      boolT bestoutside, boolT *isoutside, int *numpart);
00110 void    qh_gausselim(realT **rows, int numrow, int numcol, boolT *sign, boolT *nearzero);
00111 realT   qh_getangle(pointT *vect1, pointT *vect2);
00112 pointT *qh_getcenter(setT *vertices);
00113 pointT *qh_getcentrum(facetT *facet);
00114 realT   qh_getdistance(facetT *facet, facetT *neighbor, realT *mindist, realT *maxdist);
00115 void    qh_normalize(coordT *normal, int dim, boolT toporient);
00116 void    qh_normalize2 (coordT *normal, int dim, boolT toporient,
00117             realT *minnorm, boolT *ismin);
00118 pointT *qh_projectpoint(pointT *point, facetT *facet, realT dist);
00119 
00120 void    qh_setfacetplane(facetT *newfacets);
00121 void    qh_sethyperplane_det(int dim, coordT **rows, coordT *point0,
00122               boolT toporient, coordT *normal, realT *offset, boolT *nearzero);
00123 void    qh_sethyperplane_gauss(int dim, coordT **rows, pointT *point0,
00124              boolT toporient, coordT *normal, coordT *offset, boolT *nearzero);
00125 boolT   qh_sharpnewfacets(void);
00126 
00127 /*========= infrequently used code in geom2.c =============*/
00128 
00129 coordT *qh_copypoints(coordT *points, int numpoints, int dimension);
00130 void    qh_crossproduct(int dim, realT vecA[3], realT vecB[3], realT vecC[3]);
00131 realT   qh_determinant(realT **rows, int dim, boolT *nearzero);
00132 realT   qh_detjoggle(pointT *points, int numpoints, int dimension);
00133 void    qh_detroundoff(void);
00134 realT   qh_detsimplex(pointT *apex, setT *points, int dim, boolT *nearzero);
00135 realT   qh_distnorm(int dim, pointT *point, pointT *normal, realT *offsetp);
00136 realT   qh_distround(int dimension, realT maxabs, realT maxsumabs);
00137 realT   qh_divzero(realT numer, realT denom, realT mindenom1, boolT *zerodiv);
00138 realT   qh_facetarea(facetT *facet);
00139 realT   qh_facetarea_simplex(int dim, coordT *apex, setT *vertices,
00140           vertexT *notvertex,  boolT toporient, coordT *normal, realT *offset);
00141 pointT *qh_facetcenter(setT *vertices);
00142 facetT *qh_findgooddist(pointT *point, facetT *facetA, realT *distp, facetT **facetlist);
00143 void    qh_getarea(facetT *facetlist);
00144 boolT   qh_gram_schmidt(int dim, realT **rows);
00145 boolT   qh_inthresholds(coordT *normal, realT *angle);
00146 void    qh_joggleinput(void);
00147 realT  *qh_maxabsval(realT *normal, int dim);
00148 setT   *qh_maxmin(pointT *points, int numpoints, int dimension);
00149 realT   qh_maxouter(void);
00150 void    qh_maxsimplex(int dim, setT *maxpoints, pointT *points, int numpoints, setT **simplex);
00151 realT   qh_minabsval(realT *normal, int dim);
00152 int     qh_mindiff(realT *vecA, realT *vecB, int dim);
00153 boolT   qh_orientoutside(facetT *facet);
00154 void    qh_outerinner(facetT *facet, realT *outerplane, realT *innerplane);
00155 coordT  qh_pointdist(pointT *point1, pointT *point2, int dim);
00156 void    qh_printmatrix(FILE *fp, const char *string, realT **rows, int numrow, int numcol);
00157 void    qh_printpoints(FILE *fp, const char *string, setT *points);
00158 void    qh_projectinput(void);
00159 void    qh_projectpoints(signed char *project, int n, realT *points,
00160              int numpoints, int dim, realT *newpoints, int newdim);
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 /* qhDEFgeom */
00174 
00175 
00176 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


libqhull
Author(s): Robert Krug
autogenerated on Tue Jun 18 2013 12:38:49