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

Function GetPointInMwm

generator/world_roads_builder/world_roads_builder.cpp:173–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173std::optional<std::pair<m2::PointD, double>> GetPointInMwm(NodePoints const & points, size_t index, bool forward)
174{
175 auto const & pointOnBorder = points[index];
176
177 m2::PointD newPoint = pointOnBorder.m_point;
178 double dist = 0.0;
179
180 while ((!forward && index > 0) || (forward && index < points.size() - 1))
181 {
182 if (forward)
183 ++index;
184 else
185 --index;
186
187 auto const & point = points[index];
188
189 if (point.m_mwm != pointOnBorder.m_mwm)
190 break;
191
192 double const curDist = mercator::DistanceOnEarth(pointOnBorder.m_point, point.m_point);
193
194 if (curDist >= kHalfSegmentLengthM)
195 return std::make_pair(point.m_point, curDist);
196
197 newPoint = point.m_point;
198 dist = curDist;
199 }
200
201 return std::make_pair(newPoint, dist);
202}
203
204bool FillCrossBorderGraph(CrossBorderGraph & graph, RegionSegmentId & curSegmentId,
205 std::vector<uint64_t> const & nodeIds,

Callers 1

FillCrossBorderGraphFunction · 0.85

Calls 2

DistanceOnEarthFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected