From e0ba327ed83f3e32933cf6cc4f61fabc50191711 Mon Sep 17 00:00:00 2001 From: Jan Niklas Hasse Date: Tue, 21 Aug 2018 13:07:06 +0200 Subject: [PATCH] Do not compare doubles with == --- poly2tri/common/shapes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/poly2tri/common/shapes.h b/poly2tri/common/shapes.h index d26ef72..0408f86 100644 --- a/poly2tri/common/shapes.h +++ b/poly2tri/common/shapes.h @@ -132,11 +132,11 @@ struct Edge { if (p1.y > p2.y) { q = &p1; p = &p2; - } else if (p1.y == p2.y) { + } else if (std::abs(p1.y - p2.y) < 1e-10) { if (p1.x > p2.x) { q = &p1; p = &p2; - } else if (p1.x == p2.x) { + } else if (std::abs(p1.x - p2.x) < 1e-10) { // Repeat points throw std::runtime_error("Edge::Edge: p1 == p2"); }