diff --git a/NewKernel_d/include/CGAL/Kernel_d/Cartesian_LA_base.h b/NewKernel_d/include/CGAL/Kernel_d/Cartesian_LA_base.h index 3064d5a2656..ec7f7693b16 100644 --- a/NewKernel_d/include/CGAL/Kernel_d/Cartesian_LA_base.h +++ b/NewKernel_d/include/CGAL/Kernel_d/Cartesian_LA_base.h @@ -47,13 +47,13 @@ struct Cartesian_LA_base_d : public Dimension_base typedef typename Same_uncertainty_nt::type Angle; - typedef Vec_ Vector_selector; - typedef typename Vector_selector::Vector Point; - typedef typename Vector_selector::Vector Vector; - typedef typename Vector_selector::Vector Vector_; - typedef typename Vector_selector::Construct_vector Constructor; - typedef typename Vector_selector::Vector_const_iterator Point_cartesian_const_iterator; - typedef typename Vector_selector::Vector_const_iterator Vector_cartesian_const_iterator; + 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 ::add::type diff --git a/NewKernel_d/include/CGAL/Kernel_d/Cartesian_LA_functors.h b/NewKernel_d/include/CGAL/Kernel_d/Cartesian_LA_functors.h index 60895b4f23b..2ca707d2746 100644 --- a/NewKernel_d/include/CGAL/Kernel_d/Cartesian_LA_functors.h +++ b/NewKernel_d/include/CGAL/Kernel_d/Cartesian_LA_functors.h @@ -132,7 +132,7 @@ template struct Construct_cartesian_const_iterator { CGAL_FUNCTOR_INIT_IGNORE(Construct_cartesian_const_iterator) typedef R_ R; typedef typename R::Vector_ argument_type; - typedef typename R::Vector_selector S_; + typedef typename R::LA_vector S_; typedef typename R::Point_cartesian_const_iterator result_type; // same as Vector typedef Tag_true Is_exact; diff --git a/NewKernel_d/include/CGAL/Vector/eigen.h b/NewKernel_d/include/CGAL/Vector/eigen.h deleted file mode 100644 index fc663cd875d..00000000000 --- a/NewKernel_d/include/CGAL/Vector/eigen.h +++ /dev/null @@ -1,208 +0,0 @@ -#ifndef CGAL_VECTOR_EIGEN_H -#define CGAL_VECTOR_EIGEN_H - -#ifndef CGAL_USE_EIGEN -#error Requires Eigen -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace CGAL { - -// Dim_ real dimension -// Max_dim_ upper bound on the dimension -template struct Eigen_vector { - typedef NT_ NT; - typedef Eigen::Matrix::value,1,Eigen::ColMajor|Eigen::AutoAlign,Eigen_dimension::value,1> type; - - struct Construct_vector { - private: - static void check_dim(int d){ - int m = Eigen_dimension::value; - CGAL_assertion((m == Eigen::Dynamic) || (d <= m)); - } - public: - - struct Dimension { - // Initialize with NaN if possible? - type operator()(int d) const { - check_dim(d); - return type(d); - } - }; - - struct Iterator { - template - type operator()(int d,Iter const& f,Iter const& e) const { - check_dim(d); - CGAL_assertion(d==std::distance(f,e)); - type a(d); - // TODO: check the right way to do this - std::copy(f,e,&a[0]); - return a; - } - }; - -#if 0 - struct Iterator_add_one { - template - type operator()(int d,Iter const& f,Iter const& e) const { - check_dim(d); - CGAL_assertion(d==std::distance(f,e)+1); - type a(d); - std::copy(f,e,&a[0]); - a[d-1]=1; - return a; - } - }; -#endif - - struct Iterator_and_last { - template - type operator()(int d,Iter const& f,Iter const& e,CGAL_FORWARDABLE(T) t) const { - check_dim(d); - CGAL_assertion(d==std::distance(f,e)+1); - type a(d); - std::copy(f,e,&a[0]); - a[d-1]=CGAL_FORWARD(T,t); - return a; - } - }; - -#ifdef CGAL_CXX0X - struct Initializer_list { - // Fix T==NT? - template - type operator()(std::initializer_list l) const { - return Iterator()(l.size(),l.begin(),l.end()); - } - }; -#endif - - struct Values { -#ifdef CGAL_CXX0X - // TODO avoid going through Initializer_list which may cause extra copies. Possibly use forward_as_tuple. - template - type operator()(U&&...u) const { - check_dim(sizeof...(U)); // use static_assert - return Initializer_list()({forward_safe(u)...}); - } -#else - -#define CODE(Z,N,_) type operator()(BOOST_PP_ENUM_PARAMS(N,NT const& t)) const { \ - check_dim(N); \ - type a(N); \ - a << BOOST_PP_ENUM_PARAMS(N,t); \ - return a; \ -} -BOOST_PP_REPEAT_FROM_TO(1, 11, CODE, _ ) -#undef CODE - -#endif - }; - - struct Values_divide { -#ifdef CGAL_CXX0X - template - type operator()(H const&h,U&&...u) const { - check_dim(sizeof...(U)); // use static_assert - return Initializer_list()({Rational_traits().make_rational(std::forward(u),h)...}); - } -#else - -#define VAR(Z,N,_) ( Rational_traits().make_rational( t##N ,h) ) -#define CODE(Z,N,_) template type \ - operator()(H const&h, BOOST_PP_ENUM_PARAMS(N,NT const& t)) const { \ - CGAL_assertion(N<=std::min(type::SizeAtCompileTime,type::MaxSizeAtCompileTime)); \ - type a(N); \ - a << BOOST_PP_ENUM(N,VAR,); \ - return a; \ - } - BOOST_PP_REPEAT_FROM_TO(1, 11, CODE, _ ) -#undef CODE -#undef VAR - -#endif - }; - }; - - - -#if (EIGEN_WORLD_VERSION>=3) - typedef NT const* const_iterator; -#else - typedef Iterator_from_indices const_iterator; -#endif - - templatestatic const_iterator vector_begin(Vec_ const&a){ -#if (EIGEN_WORLD_VERSION>=3) - return &a[0]; -#else - return const_iterator(a,0); -#endif - } - - templatestatic const_iterator vector_end(Vec_ const&a){ -#if (EIGEN_WORLD_VERSION>=3) - return &a[0]+a.size(); -#else - return const_iterator(a,a.size()); -#endif - } - -// Really needed? - templatestatic int size_of_vector(Vec_ const&v){ - return v.size(); - } - -// This complicates matter for little benefice -#if 0 -private: - template class Canonicalize_vector { - typedef typename Dimension_eigen::type S1; - typedef typename Dimension_eigen::type S2; - public: - typedef typename Vector::type type; - }; -public: - - templatestatic NT dot_product(Vec_ const&a,Vec_ const&b){ - return a.dot(b); - } - - template static typename Canonicalize_vector::type homogeneous_add(Vec1 const&a,Vec2 const&b){ - //TODO: use compile-time size when available - int d=a.size(); - typename Canonicalize_vector::type v(d); - v << b[d-1]*a.topRows(d-1)+a[d-1]*b.topRows(d-1), a[d-1]*b[d-1]; - return v; - } - - template static typename Canonicalize_vector::type homogeneous_sub(Vec1 const&a,Vec2 const&b){ - int d=a.size(); - typename Canonicalize_vector::type v(d); - v << b[d-1]*a.topRows(d-1)-a[d-1]*b.topRows(d-1), a[d-1]*b[d-1]; - return v; - } - - template static std::pair homogeneous_dot_product(Vec1 const&a,Vec2 const&b){ - int d=a.size(); - return make_pair(a.topRows(d-1).dot(b.topRows(d-1)), a[d-1]*b[d-1]); - } -#endif -}; -} - -#endif diff --git a/NewKernel_d/include/CGAL/functor_tags.h b/NewKernel_d/include/CGAL/functor_tags.h index acde16fd402..387db2095fe 100644 --- a/NewKernel_d/include/CGAL/functor_tags.h +++ b/NewKernel_d/include/CGAL/functor_tags.h @@ -4,9 +4,11 @@ namespace CGAL { class Null_type {~Null_type();}; // no such object should be created + // To construct iterators struct Begin_tag {}; struct End_tag {}; + // Functor category struct Predicate_tag {}; struct Construct_tag {}; struct Construct_iterator_tag {}; @@ -141,5 +143,18 @@ namespace CGAL { DECL_MISC(Point_dimension); DECL_MISC(Vector_dimension); #undef DECL_MISC + + + // Properties for LA + struct Has_extra_dimension_tag {}; + struct Has_plus_minus_tag {}; + struct Has_determinant_of_vectors_tag {}; + struct Has_determinant_of_points_tag {}; + struct Has_determinant_of_iterator_to_vectors_tag {}; + struct Has_determinant_of_iterator_to_points_tag {}; + + // Kernel properties + struct Point_stores_squared_distance_to_origin_tag {}; + } #endif // CGAL_FUNCTOR_TAGS_H