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.
| 82 | // For readability, consider creating a parametrized segment and using its methods instead |
| 83 | // of using this functor. |
| 84 | struct 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 |
no outgoing calls
no test coverage detected