Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:52

0001 /*<html><pre>  -<a                             href="qh-geom.htm"
0002   >-------------------------------</a><a name="TOP">-</a>
0003 
0004   geom.h
0005     header file for geometric routines
0006 
0007    see qh-geom.htm and geom.c
0008 
0009    Copyright (c) 1993-2020 The Geometry Center.
0010    $Id: //main/2019/qhull/src/libqhull/geom.h#2 $$Change: 2953 $
0011    $DateTime: 2020/05/21 22:05:32 $$Author: bbarber $
0012 */
0013 
0014 #ifndef qhDEFgeom
0015 #define qhDEFgeom 1
0016 
0017 #include "libqhull.h"
0018 
0019 /* ============ -macros- ======================== */
0020 
0021 /*-<a                             href="qh-geom.htm#TOC"
0022   >--------------------------------</a><a name="fabs_">-</a>
0023 
0024   fabs_(a)
0025     returns the absolute value of a
0026 */
0027 #define fabs_( a ) ((( a ) < 0 ) ? -( a ):( a ))
0028 
0029 /*-<a                             href="qh-geom.htm#TOC"
0030   >--------------------------------</a><a name="fmax_">-</a>
0031 
0032   fmax_(a,b)
0033     returns the maximum value of a and b
0034 */
0035 #define fmax_( a,b )  ( ( a ) < ( b ) ? ( b ) : ( a ) )
0036 
0037 /*-<a                             href="qh-geom.htm#TOC"
0038   >--------------------------------</a><a name="fmin_">-</a>
0039 
0040   fmin_(a,b)
0041     returns the minimum value of a and b
0042 */
0043 #define fmin_( a,b )  ( ( a ) > ( b ) ? ( b ) : ( a ) )
0044 
0045 /*-<a                             href="qh-geom.htm#TOC"
0046   >--------------------------------</a><a name="maximize_">-</a>
0047 
0048   maximize_(maxval, val)
0049     set maxval to val if val is greater than maxval
0050 */
0051 #define maximize_( maxval, val ) { if (( maxval ) < ( val )) ( maxval )= ( val ); }
0052 
0053 /*-<a                             href="qh-geom.htm#TOC"
0054   >--------------------------------</a><a name="minimize_">-</a>
0055 
0056   minimize_(minval, val)
0057     set minval to val if val is less than minval
0058 */
0059 #define minimize_( minval, val ) { if (( minval ) > ( val )) ( minval )= ( val ); }
0060 
0061 /*-<a                             href="qh-geom.htm#TOC"
0062   >--------------------------------</a><a name="det2_">-</a>
0063 
0064   det2_(a1, a2,
0065         b1, b2)
0066 
0067     compute a 2-d determinate
0068 */
0069 #define det2_( a1,a2,b1,b2 ) (( a1 )*( b2 ) - ( a2 )*( b1 ))
0070 
0071 /*-<a                             href="qh-geom.htm#TOC"
0072   >--------------------------------</a><a name="det3_">-</a>
0073 
0074   det3_(a1, a2, a3,
0075        b1, b2, b3,
0076        c1, c2, c3)
0077 
0078     compute a 3-d determinate
0079 */
0080 #define det3_( a1,a2,a3,b1,b2,b3,c1,c2,c3 ) ( ( a1 )*det2_( b2,b3,c2,c3 ) \
0081                 - ( b1 )*det2_( a2,a3,c2,c3 ) + ( c1 )*det2_( a2,a3,b2,b3 ) )
0082 
0083 /*-<a                             href="qh-geom.htm#TOC"
0084   >--------------------------------</a><a name="dX">-</a>
0085 
0086   dX( p1, p2 )
0087   dY( p1, p2 )
0088   dZ( p1, p2 )
0089 
0090     given two indices into rows[],
0091 
0092     compute the difference between X, Y, or Z coordinates
0093 */
0094 #define dX( p1,p2 )  ( *( rows[p1] ) - *( rows[p2] ))
0095 #define dY( p1,p2 )  ( *( rows[p1]+1 ) - *( rows[p2]+1 ))
0096 #define dZ( p1,p2 )  ( *( rows[p1]+2 ) - *( rows[p2]+2 ))
0097 #define dW( p1,p2 )  ( *( rows[p1]+3 ) - *( rows[p2]+3 ))
0098 
0099 /*============= prototypes in alphabetical order, infrequent at end ======= */
0100 
0101 void    qh_backnormal(realT **rows, int numrow, int numcol, boolT sign, coordT *normal, boolT *nearzero);
0102 void    qh_distplane(pointT *point, facetT *facet, realT *dist);
0103 facetT *qh_findbest(pointT *point, facetT *startfacet,
0104                      boolT bestoutside, boolT isnewfacets, boolT noupper,
0105                      realT *dist, boolT *isoutside, int *numpart);
0106 facetT *qh_findbesthorizon(boolT ischeckmax, pointT *point,
0107                      facetT *startfacet, boolT noupper, realT *bestdist, int *numpart);
0108 facetT *qh_findbestnew(pointT *point, facetT *startfacet, realT *dist,
0109                      boolT bestoutside, boolT *isoutside, int *numpart);
0110 void    qh_gausselim(realT **rows, int numrow, int numcol, boolT *sign, boolT *nearzero);
0111 realT   qh_getangle(pointT *vect1, pointT *vect2);
0112 pointT *qh_getcenter(setT *vertices);
0113 pointT *qh_getcentrum(facetT *facet);
0114 coordT  qh_getdistance(facetT *facet, facetT *neighbor, coordT *mindist, coordT *maxdist);
0115 void    qh_normalize(coordT *normal, int dim, boolT toporient);
0116 void    qh_normalize2(coordT *normal, int dim, boolT toporient,
0117             realT *minnorm, boolT *ismin);
0118 pointT *qh_projectpoint(pointT *point, facetT *facet, realT dist);
0119 
0120 void    qh_setfacetplane(facetT *newfacets);
0121 void    qh_sethyperplane_det(int dim, coordT **rows, coordT *point0,
0122               boolT toporient, coordT *normal, realT *offset, boolT *nearzero);
0123 void    qh_sethyperplane_gauss(int dim, coordT **rows, pointT *point0,
0124              boolT toporient, coordT *normal, coordT *offset, boolT *nearzero);
0125 boolT   qh_sharpnewfacets(void);
0126 
0127 /*========= infrequently used code in geom2.c =============*/
0128 
0129 coordT *qh_copypoints(coordT *points, int numpoints, int dimension);
0130 void    qh_crossproduct(int dim, realT vecA[3], realT vecB[3], realT vecC[3]);
0131 realT   qh_determinant(realT **rows, int dim, boolT *nearzero);
0132 realT   qh_detjoggle(pointT *points, int numpoints, int dimension);
0133 void    qh_detmaxoutside(void);
0134 void    qh_detroundoff(void);
0135 realT   qh_detsimplex(pointT *apex, setT *points, int dim, boolT *nearzero);
0136 realT   qh_distnorm(int dim, pointT *point, pointT *normal, realT *offsetp);
0137 realT   qh_distround(int dimension, realT maxabs, realT maxsumabs);
0138 realT   qh_divzero(realT numer, realT denom, realT mindenom1, boolT *zerodiv);
0139 realT   qh_facetarea(facetT *facet);
0140 realT   qh_facetarea_simplex(int dim, coordT *apex, setT *vertices,
0141           vertexT *notvertex,  boolT toporient, coordT *normal, realT *offset);
0142 pointT *qh_facetcenter(setT *vertices);
0143 facetT *qh_findgooddist(pointT *point, facetT *facetA, realT *distp, facetT **facetlist);
0144 vertexT *qh_furthestnewvertex(unsigned int unvisited, facetT *facet, realT *maxdistp /* qh.newvertex_list */);
0145 vertexT *qh_furthestvertex(facetT *facetA, facetT *facetB, realT *maxdistp, realT *mindistp);
0146 void    qh_getarea(facetT *facetlist);
0147 boolT   qh_gram_schmidt(int dim, realT **rows);
0148 boolT   qh_inthresholds(coordT *normal, realT *angle);
0149 void    qh_joggleinput(void);
0150 realT  *qh_maxabsval(realT *normal, int dim);
0151 setT   *qh_maxmin(pointT *points, int numpoints, int dimension);
0152 realT   qh_maxouter(void);
0153 void    qh_maxsimplex(int dim, setT *maxpoints, pointT *points, int numpoints, setT **simplex);
0154 realT   qh_minabsval(realT *normal, int dim);
0155 int     qh_mindiff(realT *vecA, realT *vecB, int dim);
0156 boolT   qh_orientoutside(facetT *facet);
0157 void    qh_outerinner(facetT *facet, realT *outerplane, realT *innerplane);
0158 coordT  qh_pointdist(pointT *point1, pointT *point2, int dim);
0159 void    qh_printmatrix(FILE *fp, const char *string, realT **rows, int numrow, int numcol);
0160 void    qh_printpoints(FILE *fp, const char *string, setT *points);
0161 void    qh_projectinput(void);
0162 void    qh_projectpoints(signed char *project, int n, realT *points,
0163              int numpoints, int dim, realT *newpoints, int newdim);
0164 void    qh_rotateinput(realT **rows);
0165 void    qh_rotatepoints(realT *points, int numpoints, int dim, realT **rows);
0166 void    qh_scaleinput(void);
0167 void    qh_scalelast(coordT *points, int numpoints, int dim, coordT low,
0168                    coordT high, coordT newhigh);
0169 void    qh_scalepoints(pointT *points, int numpoints, int dim,
0170                 realT *newlows, realT *newhighs);
0171 boolT   qh_sethalfspace(int dim, coordT *coords, coordT **nextp,
0172               coordT *normal, coordT *offset, coordT *feasible);
0173 coordT *qh_sethalfspace_all(int dim, int count, coordT *halfspaces, pointT *feasible);
0174 coordT  qh_vertex_bestdist(setT *vertices);
0175 coordT  qh_vertex_bestdist2(setT *vertices, vertexT **vertexp, vertexT **vertexp2);
0176 pointT *qh_voronoi_center(int dim, setT *points);
0177 
0178 #endif /* qhDEFgeom */
0179 
0180 
0181