diff --git a/Frechet_distance/examples/Frechet_distance/CMakeLists.txt b/Frechet_distance/examples/Frechet_distance/CMakeLists.txt index febbd4f645e..55f13e94f47 100644 --- a/Frechet_distance/examples/Frechet_distance/CMakeLists.txt +++ b/Frechet_distance/examples/Frechet_distance/CMakeLists.txt @@ -17,4 +17,6 @@ create_single_source_cgal_program( "Has_filtered_predicates.cpp" ) if(TARGET CGAL::Eigen3_support) create_single_source_cgal_program( "Frechet_distance_d.cpp" ) target_link_libraries(Frechet_distance_d PUBLIC CGAL::Eigen3_support) +target_link_libraries(Frechet_distance_2 PUBLIC CGAL::Eigen3_support) +target_link_libraries(Frechet_distance_3 PUBLIC CGAL::Eigen3_support) endif() \ No newline at end of file diff --git a/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h b/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h index 289211e523c..09a93a6f339 100644 --- a/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h +++ b/Frechet_distance/include/CGAL/Frechet_distance/internal/curve.h @@ -60,60 +60,10 @@ double length_of_diagonal(const Bbox,T>& bb) // TODO: Clean up Curve -template -struct Curve_base -{ - using distance_t = Interval_nt; - using iKernel = Kernel_d_interface>> ; - using Point = typename iKernel::Point_d; - using Bbox = Bbox,double>; - using Construct_bbox = typename iKernel::Construct_bbox_d; - using Squared_distance = typename iKernel::Squared_distance_d; - using Difference_of_points = typename iKernel::Difference_of_points_d; - using Scaled_vector = typename iKernel::Scaled_vector_d; - using Translated_point = typename iKernel::Translated_point_d; - }; - template -struct Curve_base -{ - using distance_t = CGAL::Interval_nt; - using iKernel = CGAL::Simple_cartesian; - using Point = typename iKernel::Point_2; - using Bbox = Bbox_2; - using Construct_bbox = typename iKernel::Construct_bbox_2; - using Squared_distance = typename iKernel::Compute_squared_distance_2; - using Difference_of_points = typename iKernel::Construct_vector_2; - using Scaled_vector = typename iKernel::Construct_scaled_vector_2; - using Translated_point = typename iKernel::Construct_translated_point_2; -}; +struct Get_rational_kernel { -template -struct Curve_base -{ - using distance_t = CGAL::Interval_nt; - using iKernel = CGAL::Simple_cartesian; - using Point = typename iKernel::Point_3; - using Bbox = Bbox_3; - using Construct_bbox = typename iKernel::Construct_bbox_3; - using Squared_distance = typename iKernel::Compute_squared_distance_3; - using Difference_of_points = typename iKernel::Construct_vector_3; - using Scaled_vector = typename iKernel::Construct_scaled_vector_3; - using Translated_point = typename iKernel::Construct_translated_point_3; -}; - -/*! - * \ingroup PkgFrechetDistanceFunctions - * A class representing a trajectory. Additionally to the points given in the - * input file, we also store the length of any prefix of the trajectory. - */ -template -class Curve : public Curve_base -{ -public: using K = typename T::Kernel; - using Base = Curve_base; - using Self = Curve; static auto get_is_filtered() { @@ -146,8 +96,99 @@ public: } } - using Rational_kernel = decltype(get_type()); + using type = decltype(get_type()); +}; + +template +struct Curve_base +{ + static constexpr bool is_filtered = Get_rational_kernel::is_filtered; + using distance_t = Interval_nt; + using Kernel = typename T::Kernel; + using iKernel = Kernel_d_interface>>; + using Rational_kernel = typename Get_rational_kernel::type; + using Point = typename iKernel::Point_d; + using Rational_point = typename Rational_kernel::Point_d; + using Bbox = Bbox,double>; + using Construct_bbox = typename iKernel::Construct_bbox_d; + using Squared_distance = typename iKernel::Squared_distance_d; + using Difference_of_points = typename iKernel::Construct_vector_d; + using Scaled_vector = typename iKernel::Scaled_vector_d; + using Translated_point = typename iKernel::Translated_point_d; + + using D2D = NT_converter; + using I2R = KernelD_converter; + + using FT2I = NT_converter; + using K2I = KernelD_converter; +}; + +template +struct Curve_base +{ + static constexpr bool is_filtered = Get_rational_kernel::is_filtered; + + using distance_t = CGAL::Interval_nt; + using Kernel = typename T::Kernel; + using iKernel = CGAL::Simple_cartesian; + using Rational_kernel = typename Get_rational_kernel::type; + using Point = typename iKernel::Point_2; + using Rational_point = typename Rational_kernel::Point_2; + using Bbox = Bbox_2; + using Construct_bbox = typename iKernel::Construct_bbox_2; + using Squared_distance = typename iKernel::Compute_squared_distance_2; + using Difference_of_points = typename iKernel::Construct_vector_2; + using Scaled_vector = typename iKernel::Construct_scaled_vector_2; + using Translated_point = typename iKernel::Construct_translated_point_2; + + using D2D = NT_converter; + using I2R = Cartesian_converter; + + using FT2I = NT_converter; + using K2I = Cartesian_converter; +}; + +template +struct Curve_base +{ + static constexpr bool is_filtered = Get_rational_kernel::is_filtered; + using distance_t = CGAL::Interval_nt; + using Kernel = typename T::Kernel; + using iKernel = CGAL::Simple_cartesian; + using Rational_kernel = typename Get_rational_kernel::type; + using Point = typename iKernel::Point_3; + using Rational_point = typename Rational_kernel::Point_3; + using Bbox = Bbox_3; + using Construct_bbox = typename iKernel::Construct_bbox_3; + using Squared_distance = typename iKernel::Compute_squared_distance_3; + using Difference_of_points = typename iKernel::Construct_vector_3; + using Scaled_vector = typename iKernel::Construct_scaled_vector_3; + using Translated_point = typename iKernel::Construct_translated_point_3; + + using D2D = NT_converter; + using I2R = Cartesian_converter; + + using FT2I = NT_converter; + using K2I = Cartesian_converter; +}; + + +/*! + * \ingroup PkgFrechetDistanceFunctions + * A class representing a trajectory. Additionally to the points given in the + * input file, we also store the length of any prefix of the trajectory. + */ +template +class Curve : public Curve_base +{ +public: + using K = typename T::Kernel; + using Base = Curve_base; + using Self = Curve; + + + static constexpr bool is_filtered = Base::is_filtered; public: static constexpr int dimension = T::dimension; @@ -159,9 +200,9 @@ public: using Bbox = typename Base::Bbox; - using Construct_bbox = typename Base::Construct_bbox; + using Construct_bbox = typename Base::Construct_bbox; - using Squared_distance = typename Base::Squared_distance; + using Squared_distance = typename Base::Squared_distance; using Difference_of_points = typename Base::Difference_of_points; @@ -173,28 +214,13 @@ public: using Points = std::vector; using InputPoints = std::vector; + using Rational_kernel = typename Base::Rational_kernel; using Rational = typename Rational_kernel::FT; - using Rational_point = std::conditional_t<(dimension == 2), - typename Rational_kernel::Point_2 , - std::conditional_t<(dimension == 3), - typename Rational_kernel::Point_3, - typename Rational_kernel::Point_d>>; - using D2D = NT_converter; - using I2R = std::conditional_t<(dimension == 2) || (dimension == 3), - Cartesian_converter, - KernelD_converter>; + using Rational_point = typename Base::Rational_point; + using I2R = typename Base::I2R; - struct K2I - { - Point operator()(const typename T::Point& p) const - { - if constexpr (dimension == 2) - return Point(p[0], p[1]); - else - return Point(p[0], p[1], p[2]); - } - }; + using K2I = typename Base::K2I; Curve() = default; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_base.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_base.h index b75630dd51f..0b785dfe60b 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_base.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_base.h @@ -22,9 +22,6 @@ namespace CGAL { template < typename FT_, typename Dim_, typename Derived_=Default> struct Cartesian_base_d : public CGAL_BASE { - typedef void Point_2; - typedef void Point_3; - typedef FT_ FT; constexpr Cartesian_base_d(){} constexpr Cartesian_base_d(int d):CGAL_BASE(d){}