Skip to content

Commit

Permalink
Disable tolerance in Orient2d collinearity test
Browse files Browse the repository at this point in the history
This fixes failures for me when trying to triangulate
concave-by-less-than-epsilon boundary polylines.
  • Loading branch information
roystgnr committed Mar 16, 2022
1 parent 8b5fa15 commit 57b3039
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion poly2tri/common/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ Orientation Orient2d(const Point& pa, const Point& pb, const Point& pc)
double detleft = (pa.x - pc.x) * (pb.y - pc.y);
double detright = (pa.y - pc.y) * (pb.x - pc.x);
double val = detleft - detright;
if (val > -EPSILON && val < EPSILON) {

// Using a tolerance here fails on concave-by-subepsilon boundaries
// if (val > -EPSILON && val < EPSILON) {
if (val == 0) {
return COLLINEAR;
} else if (val > 0) {
return CCW;
Expand Down

0 comments on commit 57b3039

Please sign in to comment.