| 101 | } |
| 102 | |
| 103 | bool SegmentCrossesRect(m2::Segment2D const & segment, m2::RectD const & rect) |
| 104 | { |
| 105 | double constexpr kEps = 1e-6; |
| 106 | bool isSideIntersected = false; |
| 107 | rect.ForEachSide([&segment, &isSideIntersected](m2::PointD const & a, m2::PointD const & b) |
| 108 | { |
| 109 | if (isSideIntersected) |
| 110 | return; |
| 111 | |
| 112 | m2::Segment2D const rectSide(a, b); |
| 113 | isSideIntersected = m2::Intersect(segment, rectSide, kEps).m_type != m2::IntersectionResult::Type::Zero; |
| 114 | }); |
| 115 | |
| 116 | return isSideIntersected; |
| 117 | } |
| 118 | |
| 119 | bool RectCoversPolyline(IRoadGraph::PointWithAltitudeVec const & junctions, m2::RectD const & rect) |
| 120 | { |
no test coverage detected