From 57b3039c05a389c733f84dfbb5088db5b7c66529 Mon Sep 17 00:00:00 2001 From: Roy Stogner Date: Tue, 15 Mar 2022 19:16:40 -0500 Subject: [PATCH] Disable tolerance in Orient2d collinearity test This fixes failures for me when trying to triangulate concave-by-less-than-epsilon boundary polylines. --- poly2tri/common/utils.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/poly2tri/common/utils.h b/poly2tri/common/utils.h index f71334c..1479fb5 100644 --- a/poly2tri/common/utils.h +++ b/poly2tri/common/utils.h @@ -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;