Kernel_d-like interface

This commit is contained in:
Marc Glisse 2011-12-07 11:04:28 +00:00
parent 13c3f90e33
commit b5b521381c
5 changed files with 54 additions and 3 deletions

View File

@ -76,6 +76,9 @@ template<class R_,bool force_=false,class Derived_=Default> struct Cartesian_com
template<class R_,bool force_=false,class Derived_=Default> struct Cartesian_complete_predicates
: public R_
{
// TODO: this doesn't look like the right place for this typedef...
typedef CartesianDKernelFunctors::Flat_orientation Flat_orientation;
typedef R_ Kernel_base;
typedef typename Default::Get<Derived_,Cartesian_complete_predicates>::type Derived;
template<class F,class D=void,class=typename map_functor_type<F>::type> struct Functor :

View File

@ -3,6 +3,7 @@
#include <vector>
#include <algorithm>
#include <iterator>
#include <CGAL/Dimension.h>
#include <CGAL/functor_tags.h>
namespace CGAL {
@ -20,7 +21,7 @@ template<class R_> struct Construct_flat_orientation : private Store_kernel<R_>
typedef typename R::template Functor<Compute_cartesian_coordinate_tag>::type CCC;
typedef typename R::LA LA;
typedef typename Increment_dimension<typename R::Max_ambient_dimension>::type Dplusone;
typedef typename LA::template Matrix<Dynamic_dimension,Dynamic_dimension,Dplusone,Dplusone>::type Matrix;
typedef typename LA::template Matrix<Dynamic_dimension_tag,Dynamic_dimension_tag,Dplusone,Dplusone>::type Matrix;
typedef typename R::template Functor<Point_dimension_tag>::type PD;
typedef Flat_orientation result_type;
@ -60,7 +61,7 @@ template<class R_> struct Construct_flat_orientation : private Store_kernel<R_>
}
//CGAL_assertion(it!=rest.end());
}
std::sort(proj.begin(),proj.last());
std::sort(proj.begin(),proj.end());
return o;
}
};
@ -69,13 +70,14 @@ template<class R_> struct Contained_in_affine_hull : private Store_kernel<R_> {
CGAL_FUNCTOR_INIT_STORE(Contained_in_affine_hull)
typedef R_ R;
typedef typename R_::FT FT;
typedef typename R::LA LA;
typedef typename R::template Type<Point_tag>::type Point;
typedef typename R::Orientation result_type;
typedef typename R::template Functor<Compute_cartesian_coordinate_tag>::type CCC;
typedef typename R::template Functor<Point_dimension_tag>::type PD;
typedef typename Increment_dimension<typename R::Default_ambient_dimension>::type D1;
typedef typename Increment_dimension<typename R::Max_ambient_dimension>::type D2;
typedef typename R::LA::template Matrix<D1,D1,D2,D2>::type Matrix;
typedef typename LA::template Matrix<D1,D1,D2,D2>::type Matrix;
// mostly copied from Construct_flat_orientation. TODO: dedup this code.
template<class Iter>

View File

@ -0,0 +1,37 @@
#ifndef CGAL_KD_KERNEL_3_INTERFACE_H
#define CGAL_KD_KERNEL_3_INTERFACE_H
#include <CGAL/functor_tags.h>
#include <CGAL/transforming_iterator.h>
#include <CGAL/marcutils.h>
#include <CGAL/tuple.h>
namespace CGAL {
template <class Base_> struct Kernel_d_interface : public Base_ {
typedef Base_ Base;
typedef Kernel_d_interface<Base> Kernel;
typedef typename Base::Flat_orientation Flat_orientation_d;
typedef typename Base::template Type<Point_tag>::type Point_d;
typedef typename Base::template Type<Vector_tag>::type Vector_d;
//typedef typename Base::template Type<Segment_tag>::type Segment_d;
typedef typename Base::template Functor<Compare_lexicographically_tag>::type Compare_lexicographically_d;
typedef typename Base::template Functor<Orientation_of_points_tag>::type Orientation_d;
typedef typename Base::template Functor<Side_of_oriented_sphere_tag>::type Side_of_oriented_sphere_d;
typedef typename Base::template Functor<Contained_in_affine_hull_tag>::type Contained_in_affine_hull_d;
typedef typename Base::template Functor<Construct_flat_orientation_tag>::type Construct_flat_orientation_d;
typedef typename Base::template Functor<In_flat_orientation_tag>::type In_flat_orientation_d;
typedef typename Base::template Functor<In_flat_side_of_oriented_sphere_tag>::type In_flat_side_of_oriented_sphere_d;
Compare_lexicographically_d compare_lexicographically_d_object()const{ return Compare_lexicographically_d(*this); }
Orientation_d orientation_d_object()const{ return Orientation_d(*this); }
Side_of_oriented_sphere_d side_of_oriented_sphere_d_object()const{ return Side_of_oriented_sphere_d(*this); }
Contained_in_affine_hull_d contained_in_affine_hull_d_object()const{ return Contained_in_affine_hull_d(*this); }
Construct_flat_orientation_d construct_flat_orientation_d_object()const{ return Construct_flat_orientation_d(*this); }
In_flat_orientation_d in_flat_orientation_d_object()const{ return In_flat_orientation_d(*this); }
In_flat_side_of_oriented_sphere_d in_flat_side_of_oriented_sphere_d_object()const{ return In_flat_side_of_oriented_sphere_d(*this); }
};
}
#endif

View File

@ -490,4 +490,5 @@ template<class R_> struct Compare_lexicographically : private Store_kernel<R_> {
}
}
#include <CGAL/Kernel_d/Coaffine.h>
#endif // CGAL_KERNEL_D_FUNCTION_OBJECTS_CARTESIAN_H

View File

@ -78,6 +78,14 @@ CGAL_Kernel_pred(Compare_distance,
compare_distance_object)
CGAL_Kernel_pred(Compare_lexicographically,
compare_lexicographically_object)
CGAL_Kernel_pred(Contained_in_affine_hull,
contained_in_affine_hull_object)
CGAL_Kernel_pred(In_flat_orientation,
in_flat_orientation_object)
CGAL_Kernel_pred(In_flat_side_of_oriented_sphere,
in_flat_side_of_oriented_sphere_object)
CGAL_Kernel_pred(Construct_flat_orientation,
construct_flat_orientation_object)
#undef CGAL_Kernel_pred
#undef CGAL_Kernel_comp