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

Class CalculatePolyLineCenter

libs/geometry/algorithm.hpp:18–37  ·  view source on GitHub ↗

This class is used to calculate a point on a polyline such as that the paths (not the distance) from that point to both ends of a polyline have the same length.

Source from the content-addressed store, hash-verified

16// such as that the paths (not the distance) from that point
17// to both ends of a polyline have the same length.
18class CalculatePolyLineCenter
19{
20public:
21 CalculatePolyLineCenter() : m_length(0.0) {}
22 void operator()(PointD const & pt);
23
24 PointD GetResult() const;
25
26private:
27 struct Value
28 {
29 Value(PointD const & p, double l) : m_p(p), m_len(l) {}
30 bool operator<(Value const & r) const { return (m_len < r.m_len); }
31 PointD m_p;
32 double m_len;
33 };
34
35 std::vector<Value> m_poly;
36 double m_length;
37};
38
39// This class is used to calculate a point such as that
40// it lays on the figure triangle that is the closest to

Callers 1

GetPolyLineCenterFunction · 0.85

Calls

no outgoing calls

Tested by 1

GetPolyLineCenterFunction · 0.68