Fix #11 - regression causing crash when abs(p1.y - p2.y) < 1e10 (#12)

This reverts commit e0ba327ed8.

While the orignal commit silences a compiler warning, it introduces incorrect
behavior in Edge constructor that causes crash later during triangulation.

See #11 for an example of a simple polygon that would cause crash
This commit is contained in:
Martin Dobias 2020-01-20 10:19:20 +01:00 committed by Jan Niklas Hasse
parent e6e63dd29e
commit e66d045060
1 changed files with 2 additions and 2 deletions

View File

@ -132,11 +132,11 @@ struct Edge {
if (p1.y > p2.y) {
q = &p1;
p = &p2;
} else if (std::abs(p1.y - p2.y) < 1e-10) {
} else if (p1.y == p2.y) {
if (p1.x > p2.x) {
q = &p1;
p = &p2;
} else if (std::abs(p1.x - p2.x) < 1e-10) {
} else if (p1.x == p2.x) {
// Repeat points
throw std::runtime_error("Edge::Edge: p1 == p2");
}