MCPcopy Create free account
hub / github.com/comaps/comaps / SegmentCrossesRect

Function SegmentCrossesRect

libs/routing/routing_helpers.cpp:103–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103bool 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
119bool RectCoversPolyline(IRoadGraph::PointWithAltitudeVec const & junctions, m2::RectD const & rect)
120{

Callers 1

RectCoversPolylineFunction · 0.85

Calls 2

ForEachSideMethod · 0.80
IntersectFunction · 0.50

Tested by

no test coverage detected