| 49 | } |
| 50 | |
| 51 | IntersectionResult Intersect(Segment2D const & seg1, Segment2D const & seg2, double eps) |
| 52 | { |
| 53 | if (!SegmentsIntersect(seg1.m_u, seg1.m_v, seg2.m_u, seg2.m_v)) |
| 54 | return IntersectionResult(IntersectionResult::Type::Zero); |
| 55 | |
| 56 | Line2D const line1(seg1); |
| 57 | Line2D const line2(seg2); |
| 58 | auto const lineIntersection = Intersect(line1, line2, eps); |
| 59 | if (lineIntersection.m_type != IntersectionResult::Type::One) |
| 60 | return lineIntersection; |
| 61 | |
| 62 | if (IsPointOnSegmentEps(lineIntersection.m_point, seg1.m_u, seg1.m_v, eps) && |
| 63 | IsPointOnSegmentEps(lineIntersection.m_point, seg2.m_u, seg2.m_v, eps)) |
| 64 | { |
| 65 | return lineIntersection; |
| 66 | } |
| 67 | |
| 68 | return IntersectionResult(IntersectionResult::Type::Zero); |
| 69 | } |
| 70 | |
| 71 | std::string DebugPrint(Segment2D const & segment) |
| 72 | { |
nothing calls this directly
no test coverage detected