WIP: apply the functor

This commit is contained in:
Andreas Fabri 2024-08-19 14:51:47 +01:00
parent d2b1ea7a22
commit 6650de88b8
4 changed files with 10 additions and 8 deletions

View File

@ -181,7 +181,7 @@ template <class Base_> struct Kernel_d_interface : public Base_ {
typedef typename Construct_cartesian_const_iterator_d::result_type Cartesian_const_iterator_d;
typedef typename Get_functor<Base, Squared_distance_tag>::type Squared_distance_d;
typedef typename Get_functor<Base, Squared_length_tag>::type Squared_length_d;
typedef typename Get_functor<Base, Construct_Bbox_tag>::type Construct_bbox_d;
typedef typename Get_functor<Base, Construct_bbox_tag>::type Construct_bbox_d;
typedef typename Get_functor<Base, Scalar_product_tag>::type Scalar_product_d;
typedef typename Get_functor<Base, Affine_rank_tag>::type Affine_rank_d;
typedef typename Get_functor<Base, Affinely_independent_tag>::type Affinely_independent_d;

View File

@ -1008,24 +1008,26 @@ template<class R_> struct Squared_length : private Store_kernel<R_> {
CGAL_KD_DEFAULT_FUNCTOR(Squared_length_tag,(CartesianDKernelFunctors::Squared_length<K>),(Vector_tag),(Construct_ttag<Vector_cartesian_const_iterator_tag>));
namespace CartesianDKernelFunctors {
template<class R_> struct Construct_Bbox : private Store_kernel<R_> {
CGAL_FUNCTOR_INIT_STORE(Construct_Bbox)
template<class R_> struct Construct_bbox : private Store_kernel<R_> {
CGAL_FUNCTOR_INIT_STORE(Construct_bbox)
typedef R_ R;
typedef typename R::Dimension Dimension;
typedef typename Get_type<R, RT_tag>::type RT;
typedef typename Get_type<R, Point_tag>::type Point;
typedef typename Get_functor<R, Construct_ttag<Point_cartesian_const_iterator_tag> >::type CI;
typedef Bbox<Dimension,double> result_type;
typedef Point argument_type;
result_type operator()(Point const&a)const{
CI ci(this->kernel());
To_interval<RT> f;
return result_type(a.dimension(), make_transforming_iterator(ci(a,Begin_tag()),f), make_transforming_iterator(ci(a,End_tag())), f);
typename Real_embeddable_traits<RT>::To_interval f;
typename Get_functor<R, Point_dimension_tag>::type pd(this->kernel());
return result_type(pd(a), make_transforming_iterator(ci(a,Begin_tag()),f), make_transforming_iterator(ci(a,End_tag())), f);
}
};
}
CGAL_KD_DEFAULT_FUNCTOR(Construct_Bbox_tag,(CartesianDKernelFunctors::Construct_Bbox<K>),(Point_tag),(Construct_ttag<Point_cartesian_const_iterator_tag>));
CGAL_KD_DEFAULT_FUNCTOR(Construct_bbox_tag,(CartesianDKernelFunctors::Construct_bbox<K>),(Point_tag),(Construct_ttag<Point_cartesian_const_iterator_tag>));
namespace CartesianDKernelFunctors {

View File

@ -201,7 +201,7 @@ namespace CGAL {
CGAL_DECL_COMPUTE(Squared_distance);
CGAL_DECL_COMPUTE(Squared_distance_to_origin);
CGAL_DECL_COMPUTE(Squared_length);
CGAL_DECL_COMPUTE(Construct_Bbox);
CGAL_DECL_COMPUTE(Construct_bbox);
CGAL_DECL_COMPUTE(Squared_radius);
CGAL_DECL_COMPUTE(Squared_circumradius);
CGAL_DECL_COMPUTE(Scalar_product);

View File

@ -211,7 +211,6 @@ void test2(){
PSBPS psbps Kinit(power_side_of_bounded_power_sphere_d_object);
CSRSOS csrsos Kinit(compute_squared_radius_smallest_orthogonal_sphere_d_object);
CGAL_USE(cb);
CGAL_USE(bc);
CGAL_USE(pol);
CGAL_USE(cat);
@ -220,6 +219,7 @@ void test2(){
CGAL_USE(cr);
using std::abs;
P a=cp(3,4);
CGAL::Bbox<CGAL::Dimension_tag<2>,double> bb2 = cb(a);
assert(pd(a)==2);
assert(pv(a)[1]==4);
P b=vp(cv(5,6,7));