|
|
@@ -36,9 +36,14 @@ 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]);
|
|
|
+ } else if (ln.first == pt || ln.second == pt) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ auto slope = dim2::line{ln.first, pt}.slope();
|
|
|
+ return (slope == ln.slope() || slope == -1/ln.slope()) &&
|
|
|
+ between(pt[0], ln.first[0], ln.second[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));
|
|
|
}
|
|
|
|
|
|
bool contains(dim2::circle const & shape, dim2::point const & pt) {
|