| 41 | } |
| 42 | |
| 43 | bool SegmentsIntersect(PointD const & a, PointD const & b, PointD const & c, PointD const & d) |
| 44 | { |
| 45 | using std::max, std::min; |
| 46 | return max(a.x, b.x) >= min(c.x, d.x) && min(a.x, b.x) <= max(c.x, d.x) && max(a.y, b.y) >= min(c.y, d.y) && |
| 47 | min(a.y, b.y) <= max(c.y, d.y) && robust::OrientedS(a, b, c) * robust::OrientedS(a, b, d) <= 0.0 && |
| 48 | robust::OrientedS(c, d, a) * robust::OrientedS(c, d, b) <= 0.0; |
| 49 | } |
| 50 | |
| 51 | IntersectionResult Intersect(Segment2D const & seg1, Segment2D const & seg2, double eps) |
| 52 | { |