Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d1c2fc0

Browse files
committed
poly2.c, poly2_r.c: fixed missing 'getid_(previousvertex)' for #143
1 parent 318d5fb commit d1c2fc0

3 files changed

Lines changed: 83 additions & 78 deletions

File tree

src/Changes.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$Id: //main/2019/qhull/src/Changes.txt#88 $$Date: 2025/08/24 $
1+
$Id: //main/2019/qhull/src/Changes.txt#87 $$Date: 2024/07/23 $
22

33
.............This file lists all changes to qhull and rbox.....................
44

@@ -56,12 +56,17 @@ Github todo 2024-2025
5656
- Add shared library for qhullcpp [S. Bruens #153]
5757
- Alternative initial simplex method [T. Brochill #151]
5858
- Detect performance issue for coplanar triangulation [C. Sheradil #146]
59-
- Remove or define undocumented option: QT [djerius #141
59+
- Remove or define undocumented option: QT [djerius #141]
6060

6161
==================
6262
== Qhull 2021-2025
6363
==================
6464

65+
------------
66+
Qhull 8.1.alpha6 GitHub 2025/09/07
67+
68+
- poly2.c, poly2_r.c: fixed missing 'getid_(previousvertex)' for #143
69+
6570
------------
6671
Qhull 8.1.alpha5 GitHub 2025/08/24
6772

src/libqhull/poly2.c

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@ void qh_check_maxout(void) {
259259
qh_distplane(point, facet, &dist);
260260
numpart++;
261261
bestfacet= qh_findbesthorizon(qh_IScheckmax, point, facet, !qh_NOupper, &dist, &numpart);
262-
if (bestfacet && dist >= maxoutside) {
262+
if (bestfacet && dist >= maxoutside) {
263263
if (qh ONLYgood && !bestfacet->good
264264
&& !((bestfacet= qh_findgooddist(point, bestfacet, &dist, &facetlist))
265-
&& dist > maxoutside)) {
265+
&& dist > maxoutside)) {
266266
notgood++;
267267
}else if (dist/maxoutside_base > qh_WIDEmaxoutside && (qh PRINTprecision || !qh ALLOWwide)) {
268268
nearest= qh_vertex_bestdist(bestfacet->vertices);
@@ -296,15 +296,15 @@ void qh_check_maxout(void) {
296296
maxoutside= facet->maxoutside;
297297
}else if (maxoutside + qh DISTround < facet->maxoutside) { /* maxoutside is computed distance, e.g., rbox 100 s D3 t1547136913 | qhull R1e-3 Tcv Qc */
298298
qh_fprintf(qh ferr, 7082, "Qhull precision warning (qh_check_maxout): f%d.maxoutside (%4.4g) is greater than computed qh.max_outside (%2.2g) + qh.DISTround (%2.2g). It should be less than or equal\n",
299-
facet->id, facet->maxoutside, maxoutside, qh DISTround);
299+
facet->id, facet->maxoutside, maxoutside, qh DISTround);
300300
}
301301
}
302302
}
303303
}
304-
qh max_outside= maxoutside;
304+
qh max_outside= maxoutside;
305305
qh_nearcoplanar(/* qh.facet_list */);
306306
qh maxoutdone= True;
307-
trace1((qh ferr, 1024, "qh_check_maxout: p%d(v%d) is qh.min_vertex %2.2g below facet f%d. Point p%d for f%d is qh.max_outside %2.2g above f%d. %d points are outside of not-good facets\n",
307+
trace1((qh ferr, 1024, "qh_check_maxout: p%d(v%d) is qh.min_vertex %2.2g below facet f%d. Point p%d for f%d is qh.max_outside %2.2g above f%d. %d points are outside of not-good facets\n",
308308
qh_pointid(minvertex->point), minvertex->id, qh min_vertex, minfacet->id, qh_pointid(maxpoint), maxpointfacet->id, qh max_outside, maxfacet->id, notgood));
309309
if(!qh ALLOWwide) {
310310
if (maxoutside/maxoutside_base > qh_WIDEmaxoutside) {
@@ -521,9 +521,9 @@ all %sfacets. Will make %2.0f distance computations.\n",
521521
else if ZEROcentrum and simplicial facet,
522522
tests vertices for neighboring simplicial facets < 0.0
523523
tests centrums of neighboring nonsimplicial facets < 0.0
524-
else if ZEROcentrum
524+
else if ZEROcentrum
525525
tests centrums of neighboring facets < 0.0
526-
else
526+
else
527527
tests centrums of neighboring facets < -qh.DISTround ('En' 'Rn')
528528
Does not test against -qh.centrum_radius since repeated computations may have different round-off errors (e.g., 'Rn')
529529
@@ -585,7 +585,7 @@ void qh_checkconvex(facetT *facetlist, int fault) {
585585
if (fault == qh_DATAfault) {
586586
qh_joggle_restart("non-convex initial simplex");
587587
if (dist > qh DISTround)
588-
qh_fprintf(qh ferr, 6114, "qhull precision error: initial simplex is not convex, since p%d(v%d) is %6.4g above opposite f%d\n",
588+
qh_fprintf(qh ferr, 6114, "qhull precision error: initial simplex is not convex, since p%d(v%d) is %6.4g above opposite f%d\n",
589589
qh_pointid(vertex->point), vertex->id, dist, neighbor->id);
590590
else
591591
qh_fprintf(qh ferr, 6379, "qhull precision error: initial simplex is not convex, since p%d(v%d) is within roundoff of opposite facet f%d (dist %6.4g)\n",
@@ -739,7 +739,7 @@ void qh_checkfacet(facetT *facet, boolT newmerge, boolT *waserrorp) {
739739
facet->id);
740740
waserror= True;
741741
}
742-
if (facet->degenerate && !facet->visible && qh_setsize(qh degen_mergeset)==0) {
742+
if (facet->degenerate && !facet->visible && qh_setsize(qh degen_mergeset)==0) {
743743
qh_fprintf(qh ferr, 6400, "qhull internal error (qh_checkfacet): degenerate facet f%d is not on qh.visible_list and qh.degen_mergeset is empty\n",
744744
facet->id);
745745
waserror= True;
@@ -756,7 +756,7 @@ void qh_checkfacet(facetT *facet, boolT newmerge, boolT *waserrorp) {
756756
waserror= True;
757757
}
758758
if (facet->newmerge) {
759-
qh_fprintf(qh ferr, 6383, "qhull internal error (qh_checkfacet): f%d is 'newmerge' but it is not a newfacet on qh.newfacet_list f%d. Missing call to qh_reducevertices\n",
759+
qh_fprintf(qh ferr, 6383, "qhull internal error (qh_checkfacet): f%d is 'newmerge' but it is not a newfacet on qh.newfacet_list f%d. Missing call to qh_reducevertices\n",
760760
facet->id, getid_(qh newfacet_list));
761761
waserror= True;
762762
}
@@ -1034,17 +1034,17 @@ boolT qh_checklists(facetT *facetlist) {
10341034
if (facetlist == qh newfacet_list || facetlist == qh visible_list) {
10351035
vertexlist= qh vertex_list;
10361036
previousvertex= NULL;
1037-
trace2((qh ferr, 2110, "qh_checklists: check qh.%s_list f%d and qh.vertex_list v%d\n",
1037+
trace2((qh ferr, 2110, "qh_checklists: check qh.%s_list f%d and qh.vertex_list v%d\n",
10381038
(facetlist == qh newfacet_list ? "newfacet" : "visible"), facetlist->id, getid_(vertexlist)));
10391039
}else {
10401040
vertexlist= qh vertex_list;
10411041
previousvertex= NULL;
1042-
trace2((qh ferr, 2111, "qh_checklists: check %slist f%d and qh.vertex_list v%d\n",
1042+
trace2((qh ferr, 2111, "qh_checklists: check %slist f%d and qh.vertex_list v%d\n",
10431043
(facetlist == qh facet_list ? "qh.facet_" : "facet"), getid_(facetlist), getid_(vertexlist)));
10441044
}
10451045
if (facetlist) {
10461046
if (qh facet_tail == NULL || qh facet_tail->id != 0 || qh facet_tail->next != NULL) {
1047-
qh_fprintf(qh ferr, 6397, "qhull internal error (qh_checklists): either qh.facet_tail f%d is NULL, or its id is not 0, or its next is not NULL\n",
1047+
qh_fprintf(qh ferr, 6397, "qhull internal error (qh_checklists): either qh.facet_tail f%d is NULL, or its id is not 0, or its next is not NULL\n",
10481048
getid_(qh facet_tail));
10491049
qh_errexit(qh_ERRqhull, qh facet_tail, NULL);
10501050
}
@@ -1056,10 +1056,10 @@ boolT qh_checklists(facetT *facetlist) {
10561056
errorfacet= facet;
10571057
errorfacet2= previousfacet;
10581058
if (facet->visitid == qh visit_id)
1059-
qh_fprintf(qh ferr, 6039, "qhull internal error (qh_checklists): f%d already in facetlist causing an infinite loop ... f%d > f%d ... > f%d > f%d. Truncate facetlist at f%d\n",
1059+
qh_fprintf(qh ferr, 6039, "qhull internal error (qh_checklists): f%d already in facetlist causing an infinite loop ... f%d > f%d ... > f%d > f%d. Truncate facetlist at f%d\n",
10601060
facet->id, facet->id, facet->next->id, getid_(previousfacet), facet->id, getid_(previousfacet));
10611061
else
1062-
qh_fprintf(qh ferr, 6350, "qhull internal error (qh_checklists): unknown or overwritten facet f%d, either id >= qh.facet_id (%d) or f.visitid %u > qh.visit_id %u. Facetlist terminated at previous facet f%d\n",
1062+
qh_fprintf(qh ferr, 6350, "qhull internal error (qh_checklists): unknown or overwritten facet f%d, either id >= qh.facet_id (%d) or f.visitid %u > qh.visit_id %u. Facetlist terminated at previous facet f%d\n",
10631063
facet->id, qh facet_id, facet->visitid, qh visit_id, getid_(previousfacet));
10641064
if (previousfacet)
10651065
previousfacet->next= qh facet_tail;
@@ -1095,21 +1095,21 @@ boolT qh_checklists(facetT *facetlist) {
10951095
}
10961096
if (facetlist == qh facet_list) {
10971097
if (!nextseen && qh facet_next && qh facet_next->next) {
1098-
qh_fprintf(qh ferr, 6369, "qhull internal error (qh_checklists): qh.facet_next f%d for qh_addpoint is not on qh.facet_list f%d\n",
1098+
qh_fprintf(qh ferr, 6369, "qhull internal error (qh_checklists): qh.facet_next f%d for qh_addpoint is not on qh.facet_list f%d\n",
10991099
qh facet_next->id, facetlist->id);
11001100
waserror= True;
11011101
errorfacet= qh facet_next;
11021102
errorfacet2= facetlist;
11031103
}
11041104
if (!newseen && qh newfacet_list && qh newfacet_list->next) {
1105-
qh_fprintf(qh ferr, 6286, "qhull internal error (qh_checklists): qh.newfacet_list f%d is not on qh.facet_list f%d\n",
1105+
qh_fprintf(qh ferr, 6286, "qhull internal error (qh_checklists): qh.newfacet_list f%d is not on qh.facet_list f%d\n",
11061106
qh newfacet_list->id, facetlist->id);
11071107
waserror= True;
11081108
errorfacet= qh newfacet_list;
11091109
errorfacet2= facetlist;
11101110
}
11111111
if (!visibleseen && qh visible_list && qh visible_list->next) {
1112-
qh_fprintf(qh ferr, 6138, "qhull internal error (qh_checklists): qh.visible_list f%d is not on qh.facet_list f%d\n",
1112+
qh_fprintf(qh ferr, 6138, "qhull internal error (qh_checklists): qh.visible_list f%d is not on qh.facet_list f%d\n",
11131113
qh visible_list->id, facetlist->id);
11141114
waserror= True;
11151115
errorfacet= qh visible_list;
@@ -1119,7 +1119,7 @@ boolT qh_checklists(facetT *facetlist) {
11191119
}
11201120
if (vertexlist) {
11211121
if (qh vertex_tail == NULL || qh vertex_tail->id != 0 || qh vertex_tail->next != NULL) {
1122-
qh_fprintf(qh ferr, 6366, "qhull internal error (qh_checklists): either qh.vertex_tail v%d is NULL, or its id is not 0, or its next is not NULL\n",
1122+
qh_fprintf(qh ferr, 6366, "qhull internal error (qh_checklists): either qh.vertex_tail v%d is NULL, or its id is not 0, or its next is not NULL\n",
11231123
getid_(qh vertex_tail));
11241124
qh_errprint("ERRONEOUS", errorfacet, errorfacet2, NULL, qh vertex_tail);
11251125
qh_errexit(qh_ERRqhull, NULL, NULL);
@@ -1130,10 +1130,10 @@ boolT qh_checklists(facetT *facetlist) {
11301130
waserror= True;
11311131
errorvertex= vertex;
11321132
if (vertex->visitid == qh visit_id)
1133-
qh_fprintf(qh ferr, 6367, "qhull internal error (qh_checklists): v%d already in vertexlist causing an infinite loop ... v%d > v%d ... > v%d > v%d. Truncate vertexlist at v%d\n",
1133+
qh_fprintf(qh ferr, 6367, "qhull internal error (qh_checklists): v%d already in vertexlist causing an infinite loop ... v%d > v%d ... > v%d > v%d. Truncate vertexlist at v%d\n",
11341134
vertex->id, vertex->id, vertex->next->id, getid_(previousvertex), vertex->id, getid_(previousvertex));
11351135
else
1136-
qh_fprintf(qh ferr, 6368, "qhull internal error (qh_checklists): unknown or overwritten vertex v%d, either id >= qh.vertex_id (%d) or v.visitid %u > qh.visit_id %u. vertexlist terminated at previous vertex v%d\n",
1136+
qh_fprintf(qh ferr, 6368, "qhull internal error (qh_checklists): unknown or overwritten vertex v%d, either id >= qh.vertex_id (%d) or v.visitid %u > qh.visit_id %u. vertexlist terminated at previous vertex v%d\n",
11371137
vertex->id, qh vertex_id, vertex->visitid, qh visit_id, getid_(previousvertex));
11381138
if (previousvertex)
11391139
previousvertex->next= qh vertex_tail;
@@ -1144,7 +1144,7 @@ boolT qh_checklists(facetT *facetlist) {
11441144
vertex->visitid= qh vertex_visit;
11451145
if (vertex->previous != previousvertex) {
11461146
qh_fprintf(qh ferr, 6427, "qhull internal error (qh_checklists): expecting v%d.previous == v%d. Got v%d\n",
1147-
vertex->id, previousvertex->id, getid_(vertex->previous));
1147+
vertex->id, getid_(previousvertex), getid_(vertex->previous));
11481148
waserror= True;
11491149
errorvertex= vertex;
11501150
}
@@ -1259,7 +1259,7 @@ void qh_checkpolygon(facetT *facetlist) {
12591259
qh_checkfacet(facet, False, &waserror);
12601260
}else if (facet->visible && qh NEWfacets) {
12611261
if (!SETempty_(facet->neighbors) || !SETempty_(facet->ridges)) {
1262-
qh_fprintf(qh ferr, 6376, "qhull internal error (qh_checkpolygon): expecting empty f.neighbors and f.ridges for visible facet f%d. Got %d neighbors and %d ridges\n",
1262+
qh_fprintf(qh ferr, 6376, "qhull internal error (qh_checkpolygon): expecting empty f.neighbors and f.ridges for visible facet f%d. Got %d neighbors and %d ridges\n",
12631263
facet->id, qh_setsize(facet->neighbors), qh_setsize(facet->ridges));
12641264
qh_errexit(qh_ERRqhull, facet, NULL);
12651265
}
@@ -1478,7 +1478,7 @@ void qh_clearcenters(qh_CENTER type) {
14781478
returns:
14791479
initializes qh.facet_list to the simplex
14801480
1481-
notes:
1481+
notes:
14821482
only called by qh_initialhull
14831483
14841484
design:
@@ -1631,11 +1631,11 @@ setT *qh_facet3vertex(facetT *facet) {
16311631
notes:
16321632
Distance is measured by distance to the facet's hyperplane. For
16331633
Delaunay facets, this is not the same as the containing facet. It may
1634-
be an adjacent facet or a different tricoplanar facet. See
1634+
be an adjacent facet or a different tricoplanar facet. See
16351635
<a href="../html/qh-code.htm#findfacet">locate a facet with qh_findbestfacet()</a>
16361636
16371637
For tricoplanar facets, this finds one of the tricoplanar facets closest
1638-
to the point.
1638+
to the point.
16391639
16401640
If inside, qh_findbestfacet performs an exhaustive search
16411641
this may be too conservative. Sometimes it is clearly required.
@@ -2581,7 +2581,7 @@ coordT qh_matchdupridge(facetT *atfacet, int atskip, int hashsize, int *hashcoun
25812581
int maxskip= 0, maxskip2= 0, goodskip= 0, goodskip2= 0;
25822582
coordT maxdist= -REALmax, maxdist2= 0.0, dupdist, dupdist2, low, high, maxgood, gooddist= 0.0;
25832583

2584-
maxgood= qh_WIDEdupridge * (qh ONEmerge + qh DISTround);
2584+
maxgood= qh_WIDEdupridge * (qh ONEmerge + qh DISTround);
25852585
hash= qh_gethash(hashsize, atfacet->vertices, qh hull_dim, 1,
25862586
SETelem_(atfacet->vertices, atskip));
25872587
trace2((qh ferr, 2046, "qh_matchdupridge: find dupridge matches for f%d skip %d hash %d hashcount %d\n",
@@ -2620,14 +2620,14 @@ coordT qh_matchdupridge(facetT *atfacet, int atskip, int hashsize, int *hashcoun
26202620
SETelem_(newfacet->neighbors, newskip)= facet;
26212621
*hashcount -= 2; /* removed two unmatched facets */
26222622
trace2((qh ferr, 2075, "qh_matchdupridge: allow tricoplanar dupridge for new f%d skip %d and f%d skip %d\n",
2623-
newfacet->id, newskip, facet->id, skip));
2623+
newfacet->id, newskip, facet->id, skip));
26242624
}else if (goodmatch && goodmatch2) {
26252625
SETelem_(goodmatch2->neighbors, goodskip2)= qh_MERGEridge; /* undo selection of goodmatch */
26262626
SETelem_(facet->neighbors, skip)= newfacet;
26272627
SETelem_(newfacet->neighbors, newskip)= facet;
26282628
*hashcount -= 2; /* removed two unmatched facets */
26292629
trace2((qh ferr, 2105, "qh_matchdupridge: make good forced merge of dupridge f%d skip %d into f%d skip %d, keep new f%d skip %d and f%d skip %d, dist %4.4g\n",
2630-
goodmatch->id, goodskip, goodmatch2->id, goodskip2, newfacet->id, newskip, facet->id, skip, gooddist));
2630+
goodmatch->id, goodskip, goodmatch2->id, goodskip2, newfacet->id, newskip, facet->id, skip, gooddist));
26312631
goodmatch2= NULL;
26322632
}else {
26332633
SETelem_(facet->neighbors, skip)= newfacet;
@@ -2639,7 +2639,7 @@ coordT qh_matchdupridge(facetT *atfacet, int atskip, int hashsize, int *hashcoun
26392639
}else { /* !makematch */
26402640
if (!facet->normal)
26412641
qh_setfacetplane(facet); /* qh_mergecycle will ignore 'mergehorizon' facets with normals, too many cases otherwise */
2642-
if (!newfacet->normal)
2642+
if (!newfacet->normal)
26432643
qh_setfacetplane(newfacet);
26442644
dupdist= qh_getdistance(facet, newfacet, &low, &high); /* ignore low/high */
26452645
dupdist2= qh_getdistance(newfacet, facet, &low, &high);
@@ -2655,7 +2655,7 @@ coordT qh_matchdupridge(facetT *atfacet, int atskip, int hashsize, int *hashcoun
26552655
break; /* force maxmatch */
26562656
}else if (facet->flipped && !newfacet->flipped && dupdist < maxgood) {
26572657
if (!goodmatch || !goodmatch->flipped || dupdist < gooddist) {
2658-
goodmatch= facet;
2658+
goodmatch= facet;
26592659
goodskip= skip;
26602660
goodmatch2= newfacet;
26612661
goodskip2= newskip;
@@ -2665,7 +2665,7 @@ coordT qh_matchdupridge(facetT *atfacet, int atskip, int hashsize, int *hashcoun
26652665
}
26662666
}else if (newfacet->flipped && !facet->flipped && dupdist2 < maxgood) {
26672667
if (!goodmatch || !goodmatch->flipped || dupdist2 < gooddist) {
2668-
goodmatch= newfacet;
2668+
goodmatch= newfacet;
26692669
goodskip= newskip;
26702670
goodmatch2= facet;
26712671
goodskip2= skip;
@@ -2685,7 +2685,7 @@ coordT qh_matchdupridge(facetT *atfacet, int atskip, int hashsize, int *hashcoun
26852685
}
26862686
}else if (dupdist2 < maxgood && (!facet->flipped || newfacet->flipped)) { /* disallow not-flipped->flipped */
26872687
if (!goodmatch || (!goodmatch->flipped && dupdist2 < gooddist)) {
2688-
goodmatch= newfacet;
2688+
goodmatch= newfacet;
26892689
goodskip= newskip;
26902690
goodmatch2= facet;
26912691
goodskip2= skip;
@@ -3135,7 +3135,7 @@ void qh_point_add(setT *set, pointT *point, void *elem) {
31353135
31363136
notes:
31373137
each point is assigned to at most one of vertices, coplanarset, or outsideset
3138-
unassigned points are interior points or
3138+
unassigned points are interior points or
31393139
vertices assigned to one of its facets
31403140
coplanarset assigned to the facet
31413141
outside set assigned to the facet
@@ -3377,7 +3377,7 @@ void qh_replacefacetvertex(facetT *facet, vertexT *oldvertex, vertexT *newvertex
33773377
reset newvertex_list, newfacet_list, visible_list, NEWfacets, NEWtentative
33783378
if stats,
33793379
maintains statistics
3380-
if resetVisible,
3380+
if resetVisible,
33813381
visible_list is restored to facet_list
33823382
otherwise, f.visible/f.replace is retained
33833383
@@ -3420,7 +3420,7 @@ void qh_resetlists(boolT stats, boolT resetVisible /* qh.newvertex_list newfacet
34203420
}
34213421
qh num_visible= 0;
34223422
}
3423-
qh visible_list= NULL;
3423+
qh visible_list= NULL;
34243424
qh NEWfacets= False;
34253425
qh NEWtentative= False;
34263426
} /* resetlists */
@@ -3576,7 +3576,7 @@ void qh_triangulate(void /* qh.facet_list */) {
35763576
trace2((qh ferr, 2052, "qh_triangulate: delete visible facets -- non-simplicial, null, and mirrored facets\n"));
35773577
owner= NULL;
35783578
visible= NULL;
3579-
for (facet=triangulated_facet_list; facet && facet->next; facet= nextfacet) {
3579+
for (facet=triangulated_facet_list; facet && facet->next; facet= nextfacet) {
35803580
/* deleting facets, triangulated_facet_list is no longer valid */
35813581
nextfacet= facet->next;
35823582
if (facet->visible) {
@@ -3720,7 +3720,7 @@ void qh_triangulate_facet(facetT *facetA, vertexT **first_vertex) {
37203720
newfacet->maxoutside= facetA->maxoutside;
37213721
#endif
37223722
}
3723-
qh_matchnewfacets(/* qh.newfacet_list */); /* ignore returned value, maxdupdist */
3723+
qh_matchnewfacets(/* qh.newfacet_list */); /* ignore returned value, maxdupdist */
37243724
zinc_(Ztricoplanar);
37253725
zadd_(Ztricoplanartot, numnew);
37263726
zmax_(Ztricoplanarmax, numnew);

0 commit comments

Comments
 (0)