mirror of https://github.com/CGAL/cgal
145 lines
6.3 KiB
C++
145 lines
6.3 KiB
C++
#ifndef CGAL_KERNEL_D_CARTESIAN_LA_BASE_H
|
|
#define CGAL_KERNEL_D_CARTESIAN_LA_BASE_H
|
|
|
|
#include <CGAL/basic.h>
|
|
#include <CGAL/Origin.h>
|
|
|
|
#include <CGAL/representation_tags.h>
|
|
#include <CGAL/functor_tags.h>
|
|
#include <CGAL/Uncertain.h>
|
|
#include <CGAL/typeset.h>
|
|
#include <CGAL/Kernel_d/Dimension_base.h>
|
|
#include <CGAL/Kernel_d/Cartesian_LA_functors.h>
|
|
#include <CGAL/Vector/array.h>
|
|
#ifdef CGAL_EIGEN3_ENABLED
|
|
#include <CGAL/LA_eigen/LA.h>
|
|
#else
|
|
#include <CGAL/LA_default/LA.h>
|
|
#endif
|
|
|
|
namespace CGAL {
|
|
|
|
template < typename FT_, typename Dim_,
|
|
#if 0
|
|
typename Vec_=Array_vector<FT_, Dim_>,
|
|
#else
|
|
typename Vec_=LA_eigen<FT_, Dim_>,
|
|
#endif
|
|
typename LA_=LA_eigen<FT_,Dim_> >
|
|
/* Default LA to Vec or to LA_eigen? */
|
|
struct Cartesian_LA_base_d : public Dimension_base<Dim_>
|
|
{
|
|
typedef FT_ FT;
|
|
typedef FT_ RT;
|
|
typedef Cartesian_LA_base_d<FT_,Dim_> Self;
|
|
typedef Cartesian_tag Rep_tag;
|
|
typedef Cartesian_tag Kernel_tag;
|
|
typedef Dim_ Default_ambient_dimension;
|
|
typedef Dim_ Max_ambient_dimension;
|
|
typedef LA_ LA;
|
|
|
|
typedef typename Same_uncertainty_nt<bool, FT>::type
|
|
Boolean;
|
|
typedef typename Same_uncertainty_nt<CGAL::Sign, FT>::type
|
|
Sign;
|
|
typedef typename Same_uncertainty_nt<CGAL::Comparison_result, FT>::type
|
|
Comparison_result;
|
|
typedef typename Same_uncertainty_nt<CGAL::Orientation, FT>::type
|
|
Orientation;
|
|
typedef typename Same_uncertainty_nt<CGAL::Oriented_side, FT>::type
|
|
Oriented_side;
|
|
typedef typename Same_uncertainty_nt<CGAL::Bounded_side, FT>::type
|
|
Bounded_side;
|
|
typedef typename Same_uncertainty_nt<CGAL::Angle, FT>::type
|
|
Angle;
|
|
|
|
typedef Vec_ LA_vector;
|
|
typedef typename LA_vector::Vector Point;
|
|
typedef typename LA_vector::Vector Vector;
|
|
typedef typename LA_vector::Vector Vector_;
|
|
typedef typename LA_vector::Construct_vector Constructor;
|
|
typedef typename LA_vector::Vector_const_iterator Point_cartesian_const_iterator;
|
|
typedef typename LA_vector::Vector_const_iterator Vector_cartesian_const_iterator;
|
|
|
|
typedef typeset<Point_tag>
|
|
::add<Vector_tag>::type
|
|
Object_list;
|
|
|
|
typedef typeset< Point_cartesian_const_iterator_tag>::type
|
|
::add<Vector_cartesian_const_iterator_tag>::type
|
|
Iterator_list;
|
|
|
|
template<class, class=void, bool=true> struct Functor {
|
|
typedef Null_functor type;
|
|
};
|
|
template<class D> struct Functor<Construct_ttag<Vector_tag>,D> {
|
|
typedef CartesianDVectorBase::Construct_LA_vector<Self,Null_vector> type;
|
|
};
|
|
template<class D> struct Functor<Construct_ttag<Point_tag>,D> {
|
|
typedef CartesianDVectorBase::Construct_LA_vector<Self,Origin> type;
|
|
};
|
|
template<class D> struct Functor<Construct_ttag<Point_cartesian_const_iterator_tag>,D> {
|
|
typedef CartesianDVectorBase::Construct_cartesian_const_iterator<Self> type;
|
|
};
|
|
template<class D> struct Functor<Construct_ttag<Vector_cartesian_const_iterator_tag>,D> {
|
|
typedef CartesianDVectorBase::Construct_cartesian_const_iterator<Self> type;
|
|
};
|
|
template<class D> struct Functor<Sum_of_vectors_tag,D,
|
|
LA_vector::template Property<Has_vector_plus_minus_tag>::value> {
|
|
typedef CartesianDVectorBase::Sum_of_vectors<Self> type;
|
|
};
|
|
template<class D> struct Functor<Difference_of_vectors_tag,D,
|
|
LA_vector::template Property<Has_vector_plus_minus_tag>::value> {
|
|
typedef CartesianDVectorBase::Difference_of_vectors<Self> type;
|
|
};
|
|
template<class D> struct Functor<Opposite_vector_tag,D,
|
|
LA_vector::template Property<Has_vector_plus_minus_tag>::value> {
|
|
typedef CartesianDVectorBase::Opposite_vector<Self> type;
|
|
};
|
|
template<class D> struct Functor<Midpoint_tag,D,
|
|
LA_vector::template Property<Has_vector_plus_minus_tag>::value &&
|
|
LA_vector::template Property<Has_vector_scalar_ops_tag>::value> {
|
|
typedef CartesianDVectorBase::Midpoint<Self> type;
|
|
};
|
|
template<class D> struct Functor<Compute_point_cartesian_coordinate_tag,D> {
|
|
typedef CartesianDVectorBase::Compute_cartesian_coordinate<Self> type;
|
|
};
|
|
template<class D> struct Functor<Compute_vector_cartesian_coordinate_tag,D> {
|
|
typedef CartesianDVectorBase::Compute_cartesian_coordinate<Self> type;
|
|
};
|
|
template<class D> struct Functor<Point_dimension_tag,D> {
|
|
typedef CartesianDVectorBase::PV_dimension<Self> type;
|
|
};
|
|
template<class D> struct Functor<Vector_dimension_tag,D> {
|
|
typedef CartesianDVectorBase::PV_dimension<Self> type;
|
|
};
|
|
template<class D> struct Functor<Orientation_of_vectors_tag,D,
|
|
LA_vector::template Property<Has_determinant_of_iterator_to_vectors_tag>::value> {
|
|
typedef CartesianDVectorBase::Orientation_of_vectors<Self> type;
|
|
};
|
|
template<class D> struct Functor<Orientation_of_points_tag,D,
|
|
LA_vector::template Property<Has_determinant_of_iterator_to_points_tag>::value> {
|
|
typedef CartesianDVectorBase::Orientation_of_points<Self> type;
|
|
};
|
|
template<class D> struct Functor<Scalar_product_tag,D,
|
|
LA_vector::template Property<Has_dot_product_tag>::value> {
|
|
typedef CartesianDVectorBase::Scalar_product<Self> type;
|
|
};
|
|
template<class D> struct Functor<Squared_distance_to_origin_tag,D,
|
|
LA_vector::template Property<Stores_squared_norm_tag>::value> {
|
|
typedef CartesianDVectorBase::Squared_distance_to_origin_stored<Self> type;
|
|
};
|
|
template<class D> struct Functor<Squared_distance_to_origin_tag,D,
|
|
!LA_vector::template Property<Stores_squared_norm_tag>::value &&
|
|
LA_vector::template Property<Has_dot_product_tag>::value> {
|
|
typedef CartesianDVectorBase::Squared_distance_to_origin_via_dotprod<Self> type;
|
|
};
|
|
|
|
CGAL_CONSTEXPR Cartesian_LA_base_d(){}
|
|
CGAL_CONSTEXPR Cartesian_LA_base_d(int d):Dimension_base<Dim_>(d){}
|
|
};
|
|
|
|
} //namespace CGAL
|
|
|
|
#endif // CGAL_KERNEL_D_CARTESIAN_LA_BASE_H
|