diff --git a/Frechet_distance/doc/Frechet_distance/PackageDescription.txt b/Frechet_distance/doc/Frechet_distance/PackageDescription.txt index 5eff28044c5..3c3f829b1f8 100644 --- a/Frechet_distance/doc/Frechet_distance/PackageDescription.txt +++ b/Frechet_distance/doc/Frechet_distance/PackageDescription.txt @@ -5,8 +5,6 @@ /// You can add some text here if you want a description at the group level /// \ingroup PkgFrechetDistanceRef -/// \todo use Construct_point_d --> currently no concept in CGAL taking 2,3, or a range of coordinates - /*! \addtogroup PkgFrechetDistanceRef diff --git a/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h b/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h index 50271283f0c..04d04c0cd1a 100644 --- a/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h +++ b/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h @@ -225,12 +225,27 @@ public: bool operator!=(Curve const& other) const { return !(*this == other); } - static IFT squared_distance(Point const& p, Point const& q, const Traits& traits) +private: + // private as it will do nasty things if p is a temporary + static auto begin(const Point& p, const Traits& traits) + { + Construct_cartesian_const_iterator_d ccci = traits.construct_cartesian_const_iterator_d_object(); + return ccci(p); + } + + static auto begin(const std::array& p, const Traits&) + { + return p.begin(); + } + +public: + template + static IFT squared_distance(P1 const& p, P2 const& q, const Traits& traits) { IFT res(0); - Construct_cartesian_const_iterator_d ccci = traits.construct_cartesian_const_iterator_d_object(); - auto itp = ccci(p), itq = ccci(q); + auto itp = begin(p, traits); + auto itq = begin(q, traits); for (int d=0;d + static IFT distance(P1 const& p, P2 const& q, const Traits& traits) { return sqrt(squared_distance(p,q, traits)); } @@ -268,8 +284,9 @@ public: template - Point interpolate_at(P const& pt) const + std::array interpolate_at(P const& pt) const { + std::array b_coords; // assert(pt.getFraction() >= Lambda(0) && // pt.getFraction() <= Lambda(1)); assert(( @@ -278,27 +295,25 @@ public: // is_zero(pt.getFraction())))); pt.getFraction()==0))); -// if (is_zero(pt.getFraction())) { - if (pt.getFraction()==0) { - return point(pt.getPoint()); - } - - std::array b_coords; - auto fraction = pt.getFraction().approx; - distance_t one_m_f = distance_t(1) - fraction; Construct_cartesian_const_iterator_d ccci = traits_.construct_cartesian_const_iterator_d_object(); auto itp = ccci(point(pt.getPoint())); + +// if (is_zero(pt.getFraction())) { + if (pt.getFraction()==0) { + for (int d=0; d