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

Function RectCoversPolyline

libs/routing/routing_helpers.cpp:119–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119bool RectCoversPolyline(IRoadGraph::PointWithAltitudeVec const & junctions, m2::RectD const & rect)
120{
121 if (junctions.empty())
122 return false;
123
124 if (junctions.size() == 1)
125 return rect.IsPointInside(junctions.front().GetPoint());
126
127 for (auto const & junction : junctions)
128 if (rect.IsPointInside(junction.GetPoint()))
129 return true;
130
131 // No point of polyline |junctions| lays inside |rect| but may be segments of the polyline
132 // cross |rect| borders.
133 for (size_t i = 1; i < junctions.size(); ++i)
134 {
135 m2::Segment2D const polylineSegment(junctions[i - 1].GetPoint(), junctions[i].GetPoint());
136 if (SegmentCrossesRect(polylineSegment, rect))
137 return true;
138 }
139
140 return false;
141}
142
143bool CheckGraphConnectivity(Segment const & start, bool isOutgoing, bool useRoutingOptions, size_t limit,
144 WorldGraph & graph, set<Segment> & marked)

Callers 2

FindRoadsMethod · 0.85
UNIT_TESTFunction · 0.85

Calls 6

SegmentCrossesRectFunction · 0.85
frontMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
IsPointInsideMethod · 0.45
GetPointMethod · 0.45

Tested by 1

UNIT_TESTFunction · 0.68