Do not compare doubles with ==

This commit is contained in:
Jan Niklas Hasse 2018-08-21 13:07:06 +02:00
parent 0105437ff3
commit e0ba327ed8

View File

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