| 30 | } |
| 31 | |
| 32 | bool IsPointOnSegment(PointD const & pt, PointD const & p1, PointD const & p2) |
| 33 | { |
| 34 | // The epsilon here is chosen quite arbitrarily, to pass paranoid |
| 35 | // tests and to match our real-data geometry precision. If you have |
| 36 | // better ideas how to check whether pt belongs to (p1, p2) segment |
| 37 | // more precisely or without kEps, feel free to submit a pull |
| 38 | // request. |
| 39 | double constexpr kEps = 1e-100; |
| 40 | return IsPointOnSegmentEps(pt, p1, p2, kEps); |
| 41 | } |
| 42 | |
| 43 | bool SegmentsIntersect(PointD const & a, PointD const & b, PointD const & c, PointD const & d) |
| 44 | { |