MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / fastPerpendicularDistance

Function fastPerpendicularDistance

src/engine/douglas_peucker.cpp:19–30  ·  view source on GitHub ↗

Normed to the thresholds table

Source from the content-addressed store, hash-verified

17
18// Normed to the thresholds table
19std::uint64_t fastPerpendicularDistance(const util::FloatCoordinate &projected_start,
20 const util::FloatCoordinate &projected_target,
21 const util::FloatCoordinate &projected)
22{
23 util::FloatCoordinate projected_point_on_segment;
24 std::tie(std::ignore, projected_point_on_segment) =
25 util::coordinate_calculation::projectPointOnSegment(
26 projected_start, projected_target, projected);
27 auto squared_distance = util::coordinate_calculation::squaredEuclideanDistance(
28 projected, projected_point_on_segment);
29 return squared_distance;
30}
31
32std::vector<util::Coordinate> douglasPeucker(std::vector<util::Coordinate>::const_iterator begin,
33 std::vector<util::Coordinate>::const_iterator end,

Callers 1

douglasPeuckerFunction · 0.85

Calls 2

projectPointOnSegmentFunction · 0.85
squaredEuclideanDistanceFunction · 0.85

Tested by

no test coverage detected