Skip to content

Commit

Permalink
Do not compare doubles with ==
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Aug 21, 2018
1 parent 0105437 commit e0ba327
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions poly2tri/common/shapes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit e0ba327

Please sign in to comment.