@@ -88,39 +88,6 @@ class L1 {
8888 inline Scalar operator ()(Scalar const x) const { return std::abs (x); }
8989};
9090
91- // ! \brief L2 metric for measuring Euclidean distances between points.
92- // ! \details https://en.wikipedia.org/wiki/Euclidean_distance
93- // ! \see L1
94- template <typename Traits>
95- class L2 {
96- private:
97- using Scalar = typename Traits::ScalarType;
98-
99- public:
100- // ! \brief Calculates the distance between points \p p0 and \p p1.
101- // ! \tparam P0 Point type.
102- // ! \tparam P1 Point type.
103- // ! \param p0 Point.
104- // ! \param p1 Point.
105- template <typename P0, typename P1>
106- // The enable_if is not required but it forces implicit casts which are
107- // handled by operator()(Scalar, Scalar).
108- inline typename std::enable_if<
109- !std::is_fundamental<P0>::value && !std::is_fundamental<P1>::value,
110- Scalar>::type
111- operator ()(P0 const & p0, P1 const & p1) const {
112- return std::sqrt (internal::Sum<Traits, internal::SqrdDiff>::Op (p0, p1));
113- }
114-
115- // ! \brief Calculates the distance between two coordinates.
116- inline Scalar operator ()(Scalar const x, Scalar const y) const {
117- return std::abs (x - y);
118- }
119-
120- // ! \brief Returns the absolute value of \p x.
121- inline Scalar operator ()(Scalar const x) const { return std::abs (x); }
122- };
123-
12491// ! \brief The L2Squared semimetric measures squared Euclidean distances between
12592// ! points. It does not satisfy the triangle inequality.
12693// ! \see L1
0 commit comments