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

Function CutOffset

tools/openlr/openlr_decoder.cpp:173–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171// that point to the end.
172template <typename InputIterator>
173InputIterator CutOffset(InputIterator start, InputIterator stop, double offset, bool keepEnd)
174{
175 if (offset == 0.0)
176 return start;
177
178 for (double distance = 0.0; start != stop; ++start)
179 {
180 auto const edgeLen = EdgeLength(*start);
181 if (distance <= offset && offset < distance + edgeLen)
182 {
183 // Throw out this edge if (offset - distance) is greater than edgeLength / 2.
184 if (!keepEnd && offset - distance >= edgeLen / 2.0)
185 ++start;
186 break;
187 }
188 distance += edgeLen;
189 }
190
191 return start;
192}
193
194template <typename InputIterator, typename OutputIterator>
195void CopyWithoutOffsets(InputIterator start, InputIterator stop, OutputIterator out, uint32_t positiveOffset,

Callers 1

CopyWithoutOffsetsFunction · 0.85

Calls 1

EdgeLengthFunction · 0.85

Tested by

no test coverage detected