From 1e64d0de5157e9aead6858c38f19fe4404bcefd8 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Sat, 10 Feb 2024 18:21:44 +0100 Subject: [PATCH] Call 3d static filters from NewKernel_d --- .../NewKernel_d/Cartesian_static_filters.h | 86 ++++++++++++++++++- 1 file changed, 83 insertions(+), 3 deletions(-) diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h index 122cfe90885b..a89d2da9b1e7 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h @@ -16,6 +16,8 @@ #include // bug, should be included by the next one #include #include +#include +#include namespace CGAL { namespace SFA { // static filter adapter @@ -80,7 +82,72 @@ template struct Side_of_oriented_sphere_2 : private Store return typename internal::Static_filters_predicates::Side_of_oriented_circle_2()(P(this->kernel(),c,A),P(this->kernel(),c,B),P(this->kernel(),c,C),P(this->kernel(),c,D)); } }; -} + +template struct Adapter_3 { + typedef typename Get_type::type Point; + typedef typename Get_functor::type CC; + typedef typename Get_functor::type Orientation_base; + typedef typename Get_functor::type Side_of_oriented_sphere_base; + struct Point_3 { + R_ const&r; CC const&c; Point const& p; + Point_3(R_ const&r_, CC const&c_, Point const&p_):r(r_),c(c_),p(p_){} + decltype(auto) x()const{return c(p,0);} + decltype(auto) y()const{return c(p,1);} + decltype(auto) z()const{return c(p,2);} + }; + struct Vector_3 {}; + struct Sphere_3 {}; + struct Tetrahedron_3 {}; + struct Orientation_3 { + typedef typename Get_type::type result_type; + auto operator()(Point_3 const&A, Point_3 const&B, Point_3 const&C, Point_3 const&D)const{ + Point const* t[]={&A.p,&B.p,&C.p,&D.p}; + return Orientation_base(A.r)(make_transforming_iterator(t+0),make_transforming_iterator(t+4)); + } + }; + struct Side_of_oriented_sphere_3 { + typedef typename Get_type::type result_type; + auto operator()(Point_3 const&A, Point_3 const&B, Point_3 const&C, Point_3 const&D, Point_3 const&E)const{ + Point const* t[]={&A.p,&B.p,&C.p,&D.p}; + return Side_of_oriented_sphere_base(A.r)(make_transforming_iterator(t+0),make_transforming_iterator(t+4),E.p); + } + }; +}; +template struct Orientation_of_points_3 : private Store_kernel { + CGAL_FUNCTOR_INIT_STORE(Orientation_of_points_3) + typedef typename Get_type::type Point; + typedef typename Get_type::type result_type; + typedef typename Get_functor::type CC; + typedef Adapter_3 Adapter; + template result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{ + CC c(this->kernel()); + Point const& A=*f; + Point const& B=*++f; + Point const& C=*++f; + Point const& D=*++f; + CGAL_assertion(++f==e); + typedef typename Adapter::Point_3 P; + return typename internal::Static_filters_predicates::Orientation_3()(P(this->kernel(),c,A),P(this->kernel(),c,B),P(this->kernel(),c,C),P(this->kernel(),c,D)); + } +}; +template struct Side_of_oriented_sphere_3 : private Store_kernel { + CGAL_FUNCTOR_INIT_STORE(Side_of_oriented_sphere_3) + typedef typename Get_type::type Point; + typedef typename Get_type::type result_type; + typedef typename Get_functor::type CC; + typedef Adapter_3 Adapter; + template result_type operator()(Iter f, Iter CGAL_assertion_code(e), Point const& E)const{ + CC c(this->kernel()); + Point const& A=*f; + Point const& B=*++f; + Point const& C=*++f; + Point const& D=*++f; + CGAL_assertion(++f==e); + typedef typename Adapter::Point_3 P; + return typename internal::Static_filters_predicates::Side_of_oriented_sphere_3()(P(this->kernel(),c,A),P(this->kernel(),c,B),P(this->kernel(),c,C),P(this->kernel(),c,D),P(this->kernel(),c,E)); + } +}; +} // namespace SFA template struct Cartesian_static_filters : public R_ { @@ -109,6 +176,19 @@ struct Cartesian_static_filters, R_, Derived_> : public R_ { }; }; -} - +template +struct Cartesian_static_filters, R_, Derived_> : public R_ { + constexpr Cartesian_static_filters(){} + constexpr Cartesian_static_filters(int d):R_(d){} + typedef Cartesian_static_filters, R_, Derived_> Self; + typedef typename Default::Get::type Derived; + template struct Functor : Inherit_functor {}; + template struct Functor { + typedef SFA::Orientation_of_points_3 type; + }; + template struct Functor { + typedef SFA::Side_of_oriented_sphere_3 type; + }; +}; +} // namespace CGAL #endif