Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Analysis.AlgorithmBehavior/qhull-2012.1/src/libqhull/geom.h @ 10635

Last change on this file since 10635 was 10207, checked in by ascheibe, 11 years ago

#1886 added a unit test for volume calculation and the qhull library

File size: 7.2 KB
Line 
1/*<html><pre>  -<a                             href="qh-geom.htm"
2  >-------------------------------</a><a name="TOP">-</a>
3
4  geom.h
5    header file for geometric routines
6
7   see qh-geom.htm and geom.c
8
9   Copyright (c) 1993-2012 The Geometry Center.
10   $Id: //main/2011/qhull/src/libqhull/geom.h#3 $$Change: 1464 $
11   $DateTime: 2012/01/25 22:58:41 $$Author: bbarber $
12*/
13
14#ifndef qhDEFgeom
15#define qhDEFgeom 1
16
17#include "libqhull.h"
18
19/* ============ -macros- ======================== */
20
21/*-<a                             href="qh-geom.htm#TOC"
22  >--------------------------------</a><a name="fabs_">-</a>
23
24  fabs_(a)
25    returns the absolute value of a
26*/
27#define fabs_( a ) ((( a ) < 0 ) ? -( a ):( a ))
28
29/*-<a                             href="qh-geom.htm#TOC"
30  >--------------------------------</a><a name="fmax_">-</a>
31
32  fmax_(a,b)
33    returns the maximum value of a and b
34*/
35#define fmax_( a,b )  ( ( a ) < ( b ) ? ( b ) : ( a ) )
36
37/*-<a                             href="qh-geom.htm#TOC"
38  >--------------------------------</a><a name="fmin_">-</a>
39
40  fmin_(a,b)
41    returns the minimum value of a and b
42*/
43#define fmin_( a,b )  ( ( a ) > ( b ) ? ( b ) : ( a ) )
44
45/*-<a                             href="qh-geom.htm#TOC"
46  >--------------------------------</a><a name="maximize_">-</a>
47
48  maximize_(maxval, val)
49    set maxval to val if val is greater than maxval
50*/
51#define maximize_( maxval, val ) { if (( maxval ) < ( val )) ( maxval )= ( val ); }
52
53/*-<a                             href="qh-geom.htm#TOC"
54  >--------------------------------</a><a name="minimize_">-</a>
55
56  minimize_(minval, val)
57    set minval to val if val is less than minval
58*/
59#define minimize_( minval, val ) { if (( minval ) > ( val )) ( minval )= ( val ); }
60
61/*-<a                             href="qh-geom.htm#TOC"
62  >--------------------------------</a><a name="det2_">-</a>
63
64  det2_(a1, a2,
65        b1, b2)
66
67    compute a 2-d determinate
68*/
69#define det2_( a1,a2,b1,b2 ) (( a1 )*( b2 ) - ( a2 )*( b1 ))
70
71/*-<a                             href="qh-geom.htm#TOC"
72  >--------------------------------</a><a name="det3_">-</a>
73
74  det3_(a1, a2, a3,
75       b1, b2, b3,
76       c1, c2, c3)
77
78    compute a 3-d determinate
79*/
80#define det3_( a1,a2,a3,b1,b2,b3,c1,c2,c3 ) ( ( a1 )*det2_( b2,b3,c2,c3 ) \
81                - ( b1 )*det2_( a2,a3,c2,c3 ) + ( c1 )*det2_( a2,a3,b2,b3 ) )
82
83/*-<a                             href="qh-geom.htm#TOC"
84  >--------------------------------</a><a name="dX">-</a>
85
86  dX( p1, p2 )
87  dY( p1, p2 )
88  dZ( p1, p2 )
89
90    given two indices into rows[],
91
92    compute the difference between X, Y, or Z coordinates
93*/
94#define dX( p1,p2 )  ( *( rows[p1] ) - *( rows[p2] ))
95#define dY( p1,p2 )  ( *( rows[p1]+1 ) - *( rows[p2]+1 ))
96#define dZ( p1,p2 )  ( *( rows[p1]+2 ) - *( rows[p2]+2 ))
97#define dW( p1,p2 )  ( *( rows[p1]+3 ) - *( rows[p2]+3 ))
98
99/*============= prototypes in alphabetical order, infrequent at end ======= */
100
101void    qh_backnormal(realT **rows, int numrow, int numcol, boolT sign, coordT *normal, boolT *nearzero);
102void    qh_distplane(pointT *point, facetT *facet, realT *dist);
103facetT *qh_findbest(pointT *point, facetT *startfacet,
104                     boolT bestoutside, boolT isnewfacets, boolT noupper,
105                     realT *dist, boolT *isoutside, int *numpart);
106facetT *qh_findbesthorizon(boolT ischeckmax, pointT *point,
107                     facetT *startfacet, boolT noupper, realT *bestdist, int *numpart);
108facetT *qh_findbestnew(pointT *point, facetT *startfacet, realT *dist,
109                     boolT bestoutside, boolT *isoutside, int *numpart);
110void    qh_gausselim(realT **rows, int numrow, int numcol, boolT *sign, boolT *nearzero);
111realT   qh_getangle(pointT *vect1, pointT *vect2);
112pointT *qh_getcenter(setT *vertices);
113pointT *qh_getcentrum(facetT *facet);
114realT   qh_getdistance(facetT *facet, facetT *neighbor, realT *mindist, realT *maxdist);
115void    qh_normalize(coordT *normal, int dim, boolT toporient);
116void    qh_normalize2 (coordT *normal, int dim, boolT toporient,
117            realT *minnorm, boolT *ismin);
118pointT *qh_projectpoint(pointT *point, facetT *facet, realT dist);
119
120void    qh_setfacetplane(facetT *newfacets);
121void    qh_sethyperplane_det(int dim, coordT **rows, coordT *point0,
122              boolT toporient, coordT *normal, realT *offset, boolT *nearzero);
123void    qh_sethyperplane_gauss(int dim, coordT **rows, pointT *point0,
124             boolT toporient, coordT *normal, coordT *offset, boolT *nearzero);
125boolT   qh_sharpnewfacets(void);
126
127/*========= infrequently used code in geom2.c =============*/
128
129coordT *qh_copypoints(coordT *points, int numpoints, int dimension);
130void    qh_crossproduct(int dim, realT vecA[3], realT vecB[3], realT vecC[3]);
131realT   qh_determinant(realT **rows, int dim, boolT *nearzero);
132realT   qh_detjoggle(pointT *points, int numpoints, int dimension);
133void    qh_detroundoff(void);
134realT   qh_detsimplex(pointT *apex, setT *points, int dim, boolT *nearzero);
135realT   qh_distnorm(int dim, pointT *point, pointT *normal, realT *offsetp);
136realT   qh_distround(int dimension, realT maxabs, realT maxsumabs);
137realT   qh_divzero(realT numer, realT denom, realT mindenom1, boolT *zerodiv);
138realT   qh_facetarea(facetT *facet);
139realT   qh_facetarea_simplex(int dim, coordT *apex, setT *vertices,
140          vertexT *notvertex,  boolT toporient, coordT *normal, realT *offset);
141pointT *qh_facetcenter(setT *vertices);
142facetT *qh_findgooddist(pointT *point, facetT *facetA, realT *distp, facetT **facetlist);
143void    qh_getarea(facetT *facetlist);
144boolT   qh_gram_schmidt(int dim, realT **rows);
145boolT   qh_inthresholds(coordT *normal, realT *angle);
146void    qh_joggleinput(void);
147realT  *qh_maxabsval(realT *normal, int dim);
148setT   *qh_maxmin(pointT *points, int numpoints, int dimension);
149realT   qh_maxouter(void);
150void    qh_maxsimplex(int dim, setT *maxpoints, pointT *points, int numpoints, setT **simplex);
151realT   qh_minabsval(realT *normal, int dim);
152int     qh_mindiff(realT *vecA, realT *vecB, int dim);
153boolT   qh_orientoutside(facetT *facet);
154void    qh_outerinner(facetT *facet, realT *outerplane, realT *innerplane);
155coordT  qh_pointdist(pointT *point1, pointT *point2, int dim);
156void    qh_printmatrix(FILE *fp, const char *string, realT **rows, int numrow, int numcol);
157void    qh_printpoints(FILE *fp, const char *string, setT *points);
158void    qh_projectinput(void);
159void    qh_projectpoints(signed char *project, int n, realT *points,
160             int numpoints, int dim, realT *newpoints, int newdim);
161void    qh_rotateinput(realT **rows);
162void    qh_rotatepoints(realT *points, int numpoints, int dim, realT **rows);
163void    qh_scaleinput(void);
164void    qh_scalelast(coordT *points, int numpoints, int dim, coordT low,
165                   coordT high, coordT newhigh);
166void    qh_scalepoints(pointT *points, int numpoints, int dim,
167                realT *newlows, realT *newhighs);
168boolT   qh_sethalfspace(int dim, coordT *coords, coordT **nextp,
169              coordT *normal, coordT *offset, coordT *feasible);
170coordT *qh_sethalfspace_all(int dim, int count, coordT *halfspaces, pointT *feasible);
171pointT *qh_voronoi_center(int dim, setT *points);
172
173#endif /* qhDEFgeom */
174
175
176
Note: See TracBrowser for help on using the repository browser.