Browse Source

Fix tests for point on line with infinite slope.

Sam Jaffe 6 years ago
parent
commit
38d2560b55
1 changed files with 3 additions and 0 deletions
  1. 3 0
      math/src/common.cpp

+ 3 - 0
math/src/common.cpp

@@ -34,6 +34,9 @@ namespace math {
   }
   
   bool contains(dim2::line const & ln, dim2::point const & pt) {
+    if (ln.first[0] == ln.second[0]) {
+      return pt[0] == ln.first[0] && between(pt[1], ln.first[1], ln.second[1]);
+    }
     return approx_equal((ln.first[0] - pt[0]) * ln.slope() + pt[1],
                         ln.first[1], static_cast<float>(1E-6));
   }