diff --git a/NewKernel_d/include/CGAL/Kernel_d/Cartesian_2.h b/NewKernel_d/include/CGAL/Kernel_d/Cartesian_2.h new file mode 100644 index 00000000000..d2c8b136f44 --- /dev/null +++ b/NewKernel_d/include/CGAL/Kernel_d/Cartesian_2.h @@ -0,0 +1,29 @@ +#ifndef CGAL_KD_CARTESIAN_2_H +#define CGAL_KD_CARTESIAN_2_H +#include +#include + +namespace CGAL { +namespace CartesianDKernelFunctors { +template +struct Orientation_of_points_2 : private Store_kernel { + CGAL_FUNCTOR_INIT_STORE(Orientation_of_points_2); + typedef typename R_::template Type::type Point; + typedef typename R_::Orientation result_type; + typedef typename R_::FT FT; + template + result_type operator()(Iter f, Iter e)const{ + typename R_::template Functor::type c(this->kernel()); + Point const&A=*f; + FT const& ax=c(A,0); + FT const& ay=c(A,1); + Point const&B=*++f; + Point const&C=*++f; + CGAL_assertion(++f==e); + return sign_of_determinant(c(B,0)-ax,c(B,1)-ay,c(C,0)-ax,c(C,1)-ay); + } +}; +} +} + +#endif diff --git a/NewKernel_d/include/CGAL/Kernel_d/Cartesian_complete.h b/NewKernel_d/include/CGAL/Kernel_d/Cartesian_complete.h index 50258a506cc..4510e453930 100644 --- a/NewKernel_d/include/CGAL/Kernel_d/Cartesian_complete.h +++ b/NewKernel_d/include/CGAL/Kernel_d/Cartesian_complete.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -16,7 +17,7 @@ BOOST_MPL_HAS_XXX_TRAIT_DEF(Direction) BOOST_MPL_HAS_XXX_TRAIT_DEF(Line) } -template struct Cartesian_define_all_functors +template struct Cartesian_define_all_functors_ : public R_ { typedef R_ Kernel_base; @@ -39,6 +40,9 @@ template struct Cartesian_define_all_functors }; +template struct Cartesian_define_all_functors +: public Cartesian_per_dimension,Derived_> {}; + template struct Cartesian_complete_types : public R_ { diff --git a/NewKernel_d/include/CGAL/Kernel_d/Cartesian_per_dimension.h b/NewKernel_d/include/CGAL/Kernel_d/Cartesian_per_dimension.h new file mode 100644 index 00000000000..5f237284929 --- /dev/null +++ b/NewKernel_d/include/CGAL/Kernel_d/Cartesian_per_dimension.h @@ -0,0 +1,29 @@ +#ifndef CGAL_KD_CARTESIAN_PER_DIM_H +#define CGAL_KD_CARTESIAN_PER_DIM_H +#include +#include +#include +#include + +namespace CGAL { +template +struct Cartesian_per_dimension : public R_ {}; + +// TODO: we want to put the actual functors in some other file. Maybe name the +// classes Orientation_2 to make it easy to typedef them all. +template +struct Cartesian_per_dimension,R_,Derived_> : public R_ { + typedef R_ Kernel_base; + template struct Functor + : Kernel_base::template Functor + { }; + +#define CGAL_override_in_dim2(X) \ + template struct Functor { \ + typedef CartesianDKernelFunctors::X##_2 type; \ + } + CGAL_override_in_dim2(Orientation_of_points); +}; +} + +#endif