From 7d8c8f68bf847bb4369aa705f92e523c3b89f05c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 17 Sep 2024 14:56:19 +0100 Subject: [PATCH] more functors --- .../CGAL/Frechet_distance/internal/curve.h | 42 +++++++++++++++---- .../include/CGAL/NewKernel_d/Cartesian_base.h | 13 +++++- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h b/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h index 98fb5f07ce4..29fcaeff12b 100644 --- a/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h +++ b/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h @@ -125,13 +125,36 @@ public: Bbox_3, Bbox,double>>>; - using Construct_bbox = std::conditional_t<(dimension == 2) || (dimension == 3), - typename iKernel::Construct_bbox, - typename iKernel::Construct_bbox_d>; + using Construct_bbox = std::conditional_t<(dimension == 2), + typename iKernel::Construct_bbox_2, + std::conditional_t<(dimension == 3), + typename iKernel::Construct_bbox_3, + typename iKernel::Construct_bbox_d>>; + + using Squared_distance = std::conditional_t<(dimension == 2), + typename iKernel::Compute_squared_distance_2, + std::conditional_t<(dimension == 3), + typename iKernel::Compute_squared_distance_3, + typename iKernel::Squared_distance_d>>; + + using Difference_of_points = std::conditional_t<(dimension == 2), + typename iKernel::Construct_vector_2, + std::conditional_t<(dimension == 3), + typename iKernel::Construct_vector_3, + typename iKernel::Difference_of_points_d>>; + + using Scaled_vector = std::conditional_t<(dimension == 2), + typename iKernel::Construct_scaled_vector_2, + std::conditional_t<(dimension == 3), + typename iKernel::Construct_scaled_vector_3, + typename iKernel::Scaled_vector_d>>; + + using Translated_point = std::conditional_t<(dimension == 2), + typename iKernel::Construct_translated_point_2, + std::conditional_t<(dimension == 3), + typename iKernel::Construct_translated_point_3, + typename iKernel::Translated_point_d>>; - using Squared_distance = std::conditional_t<(dimension == 2) || (dimension == 3), - typename iKernel::Compute_squared_distance, - typename iKernel::Squared_distance_d>; using PointID = ID; using Points = std::vector; using InputPoints = std::vector; @@ -267,9 +290,12 @@ public: if (pt.getFraction()==0) { return points[pt.getPoint()]; } + Difference_of_points difference; + Scaled_vector scale; + Translated_point translate; auto fraction = pt.getFraction().approx; - return points[pt.getPoint()] + - (fraction * (points[pt.getPoint() + 1] - points[pt.getPoint()])); + return translate(points[pt.getPoint()] , + scale(difference(points[pt.getPoint() + 1], points[pt.getPoint()]), fraction)); } Point interpolate_at(PointID const& pt) const { return points[pt]; } diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_base.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_base.h index 6205ac1a197..7d1e1edcf3c 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_base.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_base.h @@ -24,8 +24,17 @@ struct Cartesian_base_d : public CGAL_BASE { typedef void Point_2; typedef void Point_3; - typedef void Construct_bbox; - typedef void Compute_squared_distance; + typedef void Construct_bbox_2; + typedef void Construct_bbox_3; + typedef void Compute_squared_distance_2; + typedef void Compute_squared_distance_3; + typedef void Construct_vector_2; + typedef void Construct_vector_3; + typedef void Construct_translated_point_2; + typedef void Construct_translated_point_3; + typedef void Construct_scaled_vector_2; + typedef void Construct_scaled_vector_3; + typedef FT_ FT; constexpr Cartesian_base_d(){} constexpr Cartesian_base_d(int d):CGAL_BASE(d){}