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

Function MaxDistance

libs/geometry/simplification.hpp:17–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15//@{
16template <typename DistanceFn, typename Iter>
17std::pair<double, Iter> MaxDistance(Iter first, Iter last, DistanceFn & distFn)
18{
19 std::pair<double, Iter> res(0.0, last);
20
21 for (Iter i = first + 1; i != last; ++i)
22 {
23 double const d = distFn(*first, *last, *i);
24 if (res.first < d)
25 {
26 res.first = d;
27 res.second = i;
28 }
29 }
30
31 return res;
32}
33
34// Actual SimplifyDP implementation.
35template <typename DistanceFn, typename Iter, typename Out>

Callers 2

SimplifyDPFunction · 0.85
SimplifyNearOptimalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected