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

Class SquaredDistanceFromSegmentToPoint

libs/geometry/parametrized_segment.hpp:84–98  ·  view source on GitHub ↗

This functor is here only for backward compatibility. It is not obvious when looking at a call site whether x should be the first or the last parameter to the fuction. For readability, consider creating a parametrized segment and using its methods instead of using this functor.

Source from the content-addressed store, hash-verified

82// For readability, consider creating a parametrized segment and using its methods instead
83// of using this functor.
84struct SquaredDistanceFromSegmentToPoint
85{
86 /// @return Squared distance from the segment [a, b] to the point x.
87 double operator()(m2::PointD const & a, m2::PointD const & b, m2::PointD const & x) const
88 {
89 ParametrizedSegment<m2::PointD> segment(a, b);
90 return segment.SquaredDistanceToPoint(x);
91 }
92
93 template <class PointT>
94 double operator()(PointT const & a, PointT const & b, PointT const & x) const
95 {
96 return this->operator()(m2::PointD(a), m2::PointD(b), m2::PointD(x));
97 }
98};
99} // namespace m2

Callers 3

SimplifyContoursFunction · 0.85
operator()Method · 0.85
SimplifyPointsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected