6
6
7
7
see qh-geom.htm and geom.h
8
8
9
- Copyright (c) 1993-2012 The Geometry Center.
10
- $Id: //main/2011 /qhull/src/libqhull/geom.c#3 $$Change: 1464 $
11
- $DateTime: 2012/01/25 22:58:41 $$Author: bbarber $
9
+ Copyright (c) 1993-2015 The Geometry Center.
10
+ $Id: //main/2015 /qhull/src/libqhull/geom.c#2 $$Change: 1995 $
11
+ $DateTime: 2015/10/13 21:59:42 $$Author: bbarber $
12
12
13
13
infrequent code goes into geom2.c
14
14
*/
@@ -465,7 +465,7 @@ facetT *qh_findbestnew(pointT *point, facetT *startfacet,
465
465
} /* end of !flipped */
466
466
} /* FORALLfacet from startfacet or qh newfacet_list */
467
467
}
468
- if (testhorizon || !bestfacet )
468
+ if (testhorizon || !bestfacet ) /* testhorizon is always True. Keep the same code as qh_findbest */
469
469
bestfacet = qh_findbesthorizon (!qh_IScheckmax , point , bestfacet ? bestfacet : startfacet ,
470
470
!qh_NOupper , & bestdist , numpart );
471
471
* dist = bestdist ;
@@ -502,7 +502,7 @@ facetT *qh_findbestnew(pointT *point, facetT *startfacet,
502
502
notes:
503
503
assumes numrow == numcol-1
504
504
505
- see Golub & van Loan 4.4-9 for back substitution
505
+ see Golub & van Loan, 1983, Eq. 4.4-9 for "Gaussian elimination with complete pivoting"
506
506
507
507
solves Ux=b where Ax=b and PA=LU
508
508
b= [0,...,0,sign or 0] (sign is either -1 or +1)
@@ -682,7 +682,7 @@ pointT *qh_getcenter(setT *vertices) {
682
682
* coord = 0.0 ;
683
683
FOREACHvertex_ (vertices )
684
684
* coord += vertex -> point [k ];
685
- * coord /= count ;
685
+ * coord /= count ; /* count>=2 by QH6003 */
686
686
}
687
687
return (center );
688
688
} /* getcenter */
@@ -801,7 +801,7 @@ void qh_normalize(coordT *normal, int dim, boolT toporient) {
801
801
if nearzero
802
802
sets norm to direction of maximum value
803
803
*/
804
- void qh_normalize2 (coordT * normal , int dim , boolT toporient ,
804
+ void qh_normalize2 (coordT * normal , int dim , boolT toporient ,
805
805
realT * minnorm , boolT * ismin ) {
806
806
int k ;
807
807
realT * colp , * maxp , norm = 0 , temp , * norm1 , * norm2 , * norm3 ;
@@ -894,7 +894,7 @@ pointT *qh_projectpoint(pointT *point, facetT *facet, realT dist) {
894
894
pointT * newpoint , * np , * normal ;
895
895
int normsize = qh normal_size ;
896
896
int k ;
897
- void * * freelistp ; /* used !qh_NOmem */
897
+ void * * freelistp ; /* used if !qh_NOmem by qh_memalloc_() */
898
898
899
899
qh_memalloc_ (normsize , freelistp , newpoint , pointT );
900
900
np = newpoint ;
@@ -932,7 +932,7 @@ void qh_setfacetplane(facetT *facet) {
932
932
int normsize = qh normal_size ;
933
933
int k ,i , oldtrace = 0 ;
934
934
realT dist ;
935
- void * * freelistp ; /* used !qh_NOmem */
935
+ void * * freelistp ; /* used if !qh_NOmem by qh_memalloc_() */
936
936
coordT * coord , * gmcoord ;
937
937
pointT * point0 = SETfirstt_ (facet -> vertices , vertexT )-> point ;
938
938
boolT nearzero = False ;
@@ -1110,7 +1110,7 @@ void qh_sethyperplane_det(int dim, coordT **rows, coordT *point0,
1110
1110
if (dim == 2 ) {
1111
1111
normal [0 ]= dY (1 ,0 );
1112
1112
normal [1 ]= dX (0 ,1 );
1113
- qh_normalize2 (normal , dim , toporient , NULL , NULL );
1113
+ qh_normalize2 (normal , dim , toporient , NULL , NULL );
1114
1114
* offset = - (point0 [0 ]* normal [0 ]+ point0 [1 ]* normal [1 ]);
1115
1115
* nearzero = False ; /* since nearzero norm => incident points */
1116
1116
}else if (dim == 3 ) {
@@ -1120,7 +1120,7 @@ void qh_sethyperplane_det(int dim, coordT **rows, coordT *point0,
1120
1120
dX (2 ,0 ), dZ (2 ,0 ));
1121
1121
normal [2 ]= det2_ (dX (2 ,0 ), dY (2 ,0 ),
1122
1122
dX (1 ,0 ), dY (1 ,0 ));
1123
- qh_normalize2 (normal , dim , toporient , NULL , NULL );
1123
+ qh_normalize2 (normal , dim , toporient , NULL , NULL );
1124
1124
* offset = - (point0 [0 ]* normal [0 ] + point0 [1 ]* normal [1 ]
1125
1125
+ point0 [2 ]* normal [2 ]);
1126
1126
maxround = qh DISTround ;
@@ -1148,7 +1148,7 @@ void qh_sethyperplane_det(int dim, coordT **rows, coordT *point0,
1148
1148
normal [3 ]= det3_ (dX (2 ,0 ), dY (2 ,0 ), dZ (2 ,0 ),
1149
1149
dX (1 ,0 ), dY (1 ,0 ), dZ (1 ,0 ),
1150
1150
dX (3 ,0 ), dY (3 ,0 ), dZ (3 ,0 ));
1151
- qh_normalize2 (normal , dim , toporient , NULL , NULL );
1151
+ qh_normalize2 (normal , dim , toporient , NULL , NULL );
1152
1152
* offset = - (point0 [0 ]* normal [0 ] + point0 [1 ]* normal [1 ]
1153
1153
+ point0 [2 ]* normal [2 ] + point0 [3 ]* normal [3 ]);
1154
1154
maxround = qh DISTround ;
@@ -1229,3 +1229,6 @@ void qh_sethyperplane_gauss(int dim, coordT **rows, pointT *point0,
1229
1229
for (k = dim - 1 ; k -- ; )
1230
1230
* offset -= * pointcoord ++ * * normalcoef ++ ;
1231
1231
} /* sethyperplane_gauss */
1232
+
1233
+
1234
+
0 commit comments