mirror of https://github.com/CGAL/cgal
extra run of the script to remove tabs and trailing whitespaces
This commit is contained in:
parent
5c5d445eb3
commit
822bc55640
|
|
@ -27,266 +27,266 @@ namespace CartesianDVectorBase {
|
||||||
template<class R_,class Zero_> struct Construct_LA_vector
|
template<class R_,class Zero_> struct Construct_LA_vector
|
||||||
: private Store_kernel<R_>
|
: private Store_kernel<R_>
|
||||||
{
|
{
|
||||||
//CGAL_FUNCTOR_INIT_IGNORE(Construct_LA_vector)
|
//CGAL_FUNCTOR_INIT_IGNORE(Construct_LA_vector)
|
||||||
CGAL_FUNCTOR_INIT_STORE(Construct_LA_vector)
|
CGAL_FUNCTOR_INIT_STORE(Construct_LA_vector)
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
typedef typename R::Constructor Constructor;
|
typedef typename R::Constructor Constructor;
|
||||||
typedef typename Get_type<R, RT_tag>::type RT;
|
typedef typename Get_type<R, RT_tag>::type RT;
|
||||||
typedef typename Get_type<R, FT_tag>::type FT;
|
typedef typename Get_type<R, FT_tag>::type FT;
|
||||||
typedef typename R::Vector_ result_type;
|
typedef typename R::Vector_ result_type;
|
||||||
typedef typename R_::Default_ambient_dimension Dimension;
|
typedef typename R_::Default_ambient_dimension Dimension;
|
||||||
result_type operator()(int d)const{
|
result_type operator()(int d)const{
|
||||||
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
||||||
return typename Constructor::Dimension()(d);
|
return typename Constructor::Dimension()(d);
|
||||||
}
|
}
|
||||||
result_type operator()()const{
|
result_type operator()()const{
|
||||||
return typename Constructor::Dimension()((std::max)(0,this->kernel().dimension()));
|
return typename Constructor::Dimension()((std::max)(0,this->kernel().dimension()));
|
||||||
}
|
}
|
||||||
result_type operator()(int d, Zero_ const&)const{
|
result_type operator()(int d, Zero_ const&)const{
|
||||||
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
||||||
return typename Constructor::Dimension()(d);
|
return typename Constructor::Dimension()(d);
|
||||||
}
|
}
|
||||||
result_type operator()(Zero_ const&)const{
|
result_type operator()(Zero_ const&)const{
|
||||||
// Makes no sense for an unknown dimension.
|
// Makes no sense for an unknown dimension.
|
||||||
return typename Constructor::Dimension()(this->kernel().dimension());
|
return typename Constructor::Dimension()(this->kernel().dimension());
|
||||||
}
|
}
|
||||||
result_type operator()(result_type const& v)const{
|
result_type operator()(result_type const& v)const{
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
result_type operator()(result_type&& v)const{
|
result_type operator()(result_type&& v)const{
|
||||||
return std::move(v);
|
return std::move(v);
|
||||||
}
|
}
|
||||||
template<class...U>
|
template<class...U>
|
||||||
typename std::enable_if<Constructible_from_each<RT,U...>::value &&
|
typename std::enable_if<Constructible_from_each<RT,U...>::value &&
|
||||||
std::is_same<Dimension_tag<int(sizeof...(U))>, Dimension>::value,
|
std::is_same<Dimension_tag<int(sizeof...(U))>, Dimension>::value,
|
||||||
result_type>::type
|
result_type>::type
|
||||||
operator()(U&&...u)const{
|
operator()(U&&...u)const{
|
||||||
return typename Constructor::Values()(std::forward<U>(u)...);
|
return typename Constructor::Values()(std::forward<U>(u)...);
|
||||||
}
|
}
|
||||||
//template<class...U,class=typename std::enable_if<Constructible_from_each<RT,U...>::value>::type,class=typename std::enable_if<(sizeof...(U)==static_dim+1)>::type,class=void>
|
//template<class...U,class=typename std::enable_if<Constructible_from_each<RT,U...>::value>::type,class=typename std::enable_if<(sizeof...(U)==static_dim+1)>::type,class=void>
|
||||||
template<class...U>
|
template<class...U>
|
||||||
typename std::enable_if<Constructible_from_each<RT,U...>::value &&
|
typename std::enable_if<Constructible_from_each<RT,U...>::value &&
|
||||||
std::is_same<Dimension_tag<int(sizeof...(U)-1)>, Dimension>::value,
|
std::is_same<Dimension_tag<int(sizeof...(U)-1)>, Dimension>::value,
|
||||||
result_type>::type
|
result_type>::type
|
||||||
operator()(U&&...u)const{
|
operator()(U&&...u)const{
|
||||||
return Apply_to_last_then_rest()(typename Constructor::Values_divide(),std::forward<U>(u)...);
|
return Apply_to_last_then_rest()(typename Constructor::Values_divide(),std::forward<U>(u)...);
|
||||||
}
|
}
|
||||||
template<class Iter> inline
|
template<class Iter> inline
|
||||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||||
(Iter f,Iter g,Cartesian_tag t)const
|
(Iter f,Iter g,Cartesian_tag t)const
|
||||||
{
|
{
|
||||||
return this->operator()((int)std::distance(f,g),f,g,t);
|
return this->operator()((int)std::distance(f,g),f,g,t);
|
||||||
}
|
}
|
||||||
template<class Iter> inline
|
template<class Iter> inline
|
||||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||||
(int d,Iter f,Iter g,Cartesian_tag)const
|
(int d,Iter f,Iter g,Cartesian_tag)const
|
||||||
{
|
{
|
||||||
CGAL_assertion(d==std::distance(f,g));
|
CGAL_assertion(d==std::distance(f,g));
|
||||||
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
||||||
return typename Constructor::Iterator()(d,f,g);
|
return typename Constructor::Iterator()(d,f,g);
|
||||||
}
|
}
|
||||||
template<class Iter> inline
|
template<class Iter> inline
|
||||||
typename std::enable_if_t<is_iterator_type<Iter,std::bidirectional_iterator_tag>::value,result_type> operator()
|
typename std::enable_if_t<is_iterator_type<Iter,std::bidirectional_iterator_tag>::value,result_type> operator()
|
||||||
(Iter f,Iter g,Homogeneous_tag)const
|
(Iter f,Iter g,Homogeneous_tag)const
|
||||||
{
|
{
|
||||||
--g;
|
--g;
|
||||||
return this->operator()((int)std::distance(f,g),f,g,*g);
|
return this->operator()((int)std::distance(f,g),f,g,*g);
|
||||||
}
|
}
|
||||||
template<class Iter> inline
|
template<class Iter> inline
|
||||||
typename std::enable_if_t<is_iterator_type<Iter,std::bidirectional_iterator_tag>::value,result_type> operator()
|
typename std::enable_if_t<is_iterator_type<Iter,std::bidirectional_iterator_tag>::value,result_type> operator()
|
||||||
(int d,Iter f,Iter g,Homogeneous_tag)const
|
(int d,Iter f,Iter g,Homogeneous_tag)const
|
||||||
{
|
{
|
||||||
--g;
|
--g;
|
||||||
return this->operator()(d,f,g,*g);
|
return this->operator()(d,f,g,*g);
|
||||||
}
|
}
|
||||||
template<class Iter> inline
|
template<class Iter> inline
|
||||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||||
(Iter f,Iter g)const
|
(Iter f,Iter g)const
|
||||||
{
|
{
|
||||||
// Shouldn't it try comparing dist(f,g) to the dimension if it is known?
|
// Shouldn't it try comparing dist(f,g) to the dimension if it is known?
|
||||||
return this->operator()(f,g,typename R::Rep_tag());
|
return this->operator()(f,g,typename R::Rep_tag());
|
||||||
}
|
}
|
||||||
template<class Iter> inline
|
template<class Iter> inline
|
||||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||||
(int d,Iter f,Iter g)const
|
(int d,Iter f,Iter g)const
|
||||||
{
|
{
|
||||||
return this->operator()(d,f,g,typename R::Rep_tag());
|
return this->operator()(d,f,g,typename R::Rep_tag());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last homogeneous coordinate given separately
|
// Last homogeneous coordinate given separately
|
||||||
template<class Iter,class NT> inline
|
template<class Iter,class NT> inline
|
||||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||||
(int d,Iter f,Iter g,NT const&l)const
|
(int d,Iter f,Iter g,NT const&l)const
|
||||||
{
|
{
|
||||||
CGAL_assertion(d==std::distance(f,g));
|
CGAL_assertion(d==std::distance(f,g));
|
||||||
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
||||||
// RT? better be safe for now
|
// RT? better be safe for now
|
||||||
return typename Constructor::Iterator()(d,CGAL::make_transforming_iterator(f,Divide<FT,NT>(l)),CGAL::make_transforming_iterator(g,Divide<FT,NT>(l)));
|
return typename Constructor::Iterator()(d,CGAL::make_transforming_iterator(f,Divide<FT,NT>(l)),CGAL::make_transforming_iterator(g,Divide<FT,NT>(l)));
|
||||||
}
|
}
|
||||||
template<class Iter,class NT> inline
|
template<class Iter,class NT> inline
|
||||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||||
(Iter f,Iter g,NT const&l)const
|
(Iter f,Iter g,NT const&l)const
|
||||||
{
|
{
|
||||||
return this->operator()((int)std::distance(f,g),f,g,l);
|
return this->operator()((int)std::distance(f,g),f,g,l);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R_> struct Compute_cartesian_coordinate {
|
template<class R_> struct Compute_cartesian_coordinate {
|
||||||
CGAL_FUNCTOR_INIT_IGNORE(Compute_cartesian_coordinate)
|
CGAL_FUNCTOR_INIT_IGNORE(Compute_cartesian_coordinate)
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
typedef typename Get_type<R, RT_tag>::type RT;
|
typedef typename Get_type<R, RT_tag>::type RT;
|
||||||
typedef typename R::Vector_ first_argument_type;
|
typedef typename R::Vector_ first_argument_type;
|
||||||
typedef int second_argument_type;
|
typedef int second_argument_type;
|
||||||
typedef Tag_true Is_exact;
|
typedef Tag_true Is_exact;
|
||||||
typedef decltype(std::declval<const first_argument_type>()[0]) result_type;
|
typedef decltype(std::declval<const first_argument_type>()[0]) result_type;
|
||||||
|
|
||||||
template <typename index_type>
|
template <typename index_type>
|
||||||
result_type operator()(first_argument_type const& v,index_type i)const{
|
result_type operator()(first_argument_type const& v,index_type i)const{
|
||||||
return v[i];
|
return v[i];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R_> struct Construct_cartesian_const_iterator {
|
template<class R_> struct Construct_cartesian_const_iterator {
|
||||||
CGAL_FUNCTOR_INIT_IGNORE(Construct_cartesian_const_iterator)
|
CGAL_FUNCTOR_INIT_IGNORE(Construct_cartesian_const_iterator)
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
typedef typename R::Vector_ argument_type;
|
typedef typename R::Vector_ argument_type;
|
||||||
typedef typename R::LA_vector S_;
|
typedef typename R::LA_vector S_;
|
||||||
typedef typename R::Point_cartesian_const_iterator result_type;
|
typedef typename R::Point_cartesian_const_iterator result_type;
|
||||||
// same as Vector
|
// same as Vector
|
||||||
typedef Tag_true Is_exact;
|
typedef Tag_true Is_exact;
|
||||||
|
|
||||||
result_type operator()(argument_type const& v,Begin_tag)const{
|
result_type operator()(argument_type const& v,Begin_tag)const{
|
||||||
return S_::vector_begin(v);
|
return S_::vector_begin(v);
|
||||||
}
|
}
|
||||||
result_type operator()(argument_type const& v,End_tag)const{
|
result_type operator()(argument_type const& v,End_tag)const{
|
||||||
return S_::vector_end(v);
|
return S_::vector_end(v);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R_> struct Midpoint {
|
template<class R_> struct Midpoint {
|
||||||
CGAL_FUNCTOR_INIT_IGNORE(Midpoint)
|
CGAL_FUNCTOR_INIT_IGNORE(Midpoint)
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
typedef typename Get_type<R, Point_tag>::type first_argument_type;
|
typedef typename Get_type<R, Point_tag>::type first_argument_type;
|
||||||
typedef typename Get_type<R, Point_tag>::type second_argument_type;
|
typedef typename Get_type<R, Point_tag>::type second_argument_type;
|
||||||
typedef typename Get_type<R, Point_tag>::type result_type;
|
typedef typename Get_type<R, Point_tag>::type result_type;
|
||||||
|
|
||||||
result_type operator()(result_type const& a, result_type const& b)const{
|
result_type operator()(result_type const& a, result_type const& b)const{
|
||||||
return (a+b)/2;
|
return (a+b)/2;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R_> struct Sum_of_vectors {
|
template<class R_> struct Sum_of_vectors {
|
||||||
CGAL_FUNCTOR_INIT_IGNORE(Sum_of_vectors)
|
CGAL_FUNCTOR_INIT_IGNORE(Sum_of_vectors)
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
typedef typename Get_type<R, Vector_tag>::type first_argument_type;
|
typedef typename Get_type<R, Vector_tag>::type first_argument_type;
|
||||||
typedef typename Get_type<R, Vector_tag>::type second_argument_type;
|
typedef typename Get_type<R, Vector_tag>::type second_argument_type;
|
||||||
typedef typename Get_type<R, Vector_tag>::type result_type;
|
typedef typename Get_type<R, Vector_tag>::type result_type;
|
||||||
|
|
||||||
result_type operator()(result_type const& a, result_type const& b)const{
|
result_type operator()(result_type const& a, result_type const& b)const{
|
||||||
return a+b;
|
return a+b;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R_> struct Difference_of_vectors {
|
template<class R_> struct Difference_of_vectors {
|
||||||
CGAL_FUNCTOR_INIT_IGNORE(Difference_of_vectors)
|
CGAL_FUNCTOR_INIT_IGNORE(Difference_of_vectors)
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
typedef typename Get_type<R, Vector_tag>::type first_argument_type;
|
typedef typename Get_type<R, Vector_tag>::type first_argument_type;
|
||||||
typedef typename Get_type<R, Vector_tag>::type second_argument_type;
|
typedef typename Get_type<R, Vector_tag>::type second_argument_type;
|
||||||
typedef typename Get_type<R, Vector_tag>::type result_type;
|
typedef typename Get_type<R, Vector_tag>::type result_type;
|
||||||
|
|
||||||
result_type operator()(result_type const& a, result_type const& b)const{
|
result_type operator()(result_type const& a, result_type const& b)const{
|
||||||
return a-b;
|
return a-b;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R_> struct Opposite_vector {
|
template<class R_> struct Opposite_vector {
|
||||||
CGAL_FUNCTOR_INIT_IGNORE(Opposite_vector)
|
CGAL_FUNCTOR_INIT_IGNORE(Opposite_vector)
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
typedef typename Get_type<R, Vector_tag>::type result_type;
|
typedef typename Get_type<R, Vector_tag>::type result_type;
|
||||||
typedef typename Get_type<R, Vector_tag>::type argument_type;
|
typedef typename Get_type<R, Vector_tag>::type argument_type;
|
||||||
|
|
||||||
result_type operator()(result_type const& v)const{
|
result_type operator()(result_type const& v)const{
|
||||||
return -v;
|
return -v;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R_> struct Scalar_product {
|
template<class R_> struct Scalar_product {
|
||||||
CGAL_FUNCTOR_INIT_IGNORE(Scalar_product)
|
CGAL_FUNCTOR_INIT_IGNORE(Scalar_product)
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
typedef typename R::LA_vector LA;
|
typedef typename R::LA_vector LA;
|
||||||
typedef typename Get_type<R, RT_tag>::type result_type;
|
typedef typename Get_type<R, RT_tag>::type result_type;
|
||||||
typedef typename Get_type<R, Vector_tag>::type first_argument_type;
|
typedef typename Get_type<R, Vector_tag>::type first_argument_type;
|
||||||
typedef typename Get_type<R, Vector_tag>::type second_argument_type;
|
typedef typename Get_type<R, Vector_tag>::type second_argument_type;
|
||||||
|
|
||||||
result_type operator()(first_argument_type const& a, second_argument_type const& b)const{
|
result_type operator()(first_argument_type const& a, second_argument_type const& b)const{
|
||||||
return LA::dot_product(a,b);
|
return LA::dot_product(a,b);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R_> struct Squared_distance_to_origin_stored {
|
template<class R_> struct Squared_distance_to_origin_stored {
|
||||||
CGAL_FUNCTOR_INIT_IGNORE(Squared_distance_to_origin_stored)
|
CGAL_FUNCTOR_INIT_IGNORE(Squared_distance_to_origin_stored)
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
typedef typename R::LA_vector LA;
|
typedef typename R::LA_vector LA;
|
||||||
typedef typename Get_type<R, RT_tag>::type result_type;
|
typedef typename Get_type<R, RT_tag>::type result_type;
|
||||||
typedef typename Get_type<R, Point_tag>::type argument_type;
|
typedef typename Get_type<R, Point_tag>::type argument_type;
|
||||||
|
|
||||||
result_type operator()(argument_type const& a)const{
|
result_type operator()(argument_type const& a)const{
|
||||||
return LA::squared_norm(a);
|
return LA::squared_norm(a);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R_> struct Squared_distance_to_origin_via_dotprod {
|
template<class R_> struct Squared_distance_to_origin_via_dotprod {
|
||||||
CGAL_FUNCTOR_INIT_IGNORE(Squared_distance_to_origin_via_dotprod)
|
CGAL_FUNCTOR_INIT_IGNORE(Squared_distance_to_origin_via_dotprod)
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
typedef typename R::LA_vector LA;
|
typedef typename R::LA_vector LA;
|
||||||
typedef typename Get_type<R, RT_tag>::type result_type;
|
typedef typename Get_type<R, RT_tag>::type result_type;
|
||||||
typedef typename Get_type<R, Point_tag>::type argument_type;
|
typedef typename Get_type<R, Point_tag>::type argument_type;
|
||||||
|
|
||||||
result_type operator()(argument_type const& a)const{
|
result_type operator()(argument_type const& a)const{
|
||||||
return LA::dot_product(a,a);
|
return LA::dot_product(a,a);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R_> struct Orientation_of_vectors {
|
template<class R_> struct Orientation_of_vectors {
|
||||||
CGAL_FUNCTOR_INIT_IGNORE(Orientation_of_vectors)
|
CGAL_FUNCTOR_INIT_IGNORE(Orientation_of_vectors)
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
typedef typename R::Vector_cartesian_const_iterator first_argument_type;
|
typedef typename R::Vector_cartesian_const_iterator first_argument_type;
|
||||||
typedef typename R::Vector_cartesian_const_iterator second_argument_type;
|
typedef typename R::Vector_cartesian_const_iterator second_argument_type;
|
||||||
typedef typename Get_type<R, Orientation_tag>::type result_type;
|
typedef typename Get_type<R, Orientation_tag>::type result_type;
|
||||||
typedef typename R::LA_vector LA;
|
typedef typename R::LA_vector LA;
|
||||||
|
|
||||||
template<class Iter>
|
template<class Iter>
|
||||||
result_type operator()(Iter const& f, Iter const& e) const {
|
result_type operator()(Iter const& f, Iter const& e) const {
|
||||||
return LA::determinant_of_iterators_to_vectors(f,e);
|
return LA::determinant_of_iterators_to_vectors(f,e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R_> struct Orientation_of_points {
|
template<class R_> struct Orientation_of_points {
|
||||||
CGAL_FUNCTOR_INIT_IGNORE(Orientation_of_points)
|
CGAL_FUNCTOR_INIT_IGNORE(Orientation_of_points)
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
typedef typename R::Point_cartesian_const_iterator first_argument_type;
|
typedef typename R::Point_cartesian_const_iterator first_argument_type;
|
||||||
typedef typename R::Point_cartesian_const_iterator second_argument_type;
|
typedef typename R::Point_cartesian_const_iterator second_argument_type;
|
||||||
typedef typename Get_type<R, Orientation_tag>::type result_type;
|
typedef typename Get_type<R, Orientation_tag>::type result_type;
|
||||||
typedef typename R::LA_vector LA;
|
typedef typename R::LA_vector LA;
|
||||||
|
|
||||||
template<class Iter>
|
template<class Iter>
|
||||||
result_type operator()(Iter const& f, Iter const& e) const {
|
result_type operator()(Iter const& f, Iter const& e) const {
|
||||||
return LA::determinant_of_iterators_to_points(f,e);
|
return LA::determinant_of_iterators_to_points(f,e);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R_> struct PV_dimension {
|
template<class R_> struct PV_dimension {
|
||||||
CGAL_FUNCTOR_INIT_IGNORE(PV_dimension)
|
CGAL_FUNCTOR_INIT_IGNORE(PV_dimension)
|
||||||
typedef R_ R;
|
typedef R_ R;
|
||||||
typedef typename R::Vector_ argument_type;
|
typedef typename R::Vector_ argument_type;
|
||||||
typedef int result_type;
|
typedef int result_type;
|
||||||
typedef typename R::LA_vector LA;
|
typedef typename R::LA_vector LA;
|
||||||
typedef Tag_true Is_exact;
|
typedef Tag_true Is_exact;
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
result_type operator()(T const& v) const {
|
result_type operator()(T const& v) const {
|
||||||
return LA::size_of_vector(v);
|
return LA::size_of_vector(v);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R_> struct Identity_functor {
|
template<class R_> struct Identity_functor {
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ struct Cartesian_filter_K : public Base_,
|
||||||
};
|
};
|
||||||
// TODO:
|
// TODO:
|
||||||
// template<class T> struct Functor<T,No_filter_tag,Predicate_tag> :
|
// template<class T> struct Functor<T,No_filter_tag,Predicate_tag> :
|
||||||
// Kernel_base::template Functor<T,No_filter_tag> {};
|
// Kernel_base::template Functor<T,No_filter_tag> {};
|
||||||
// TODO:
|
// TODO:
|
||||||
// detect when Less_cartesian_coordinate doesn't need filtering
|
// detect when Less_cartesian_coordinate doesn't need filtering
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -78,12 +78,12 @@ public:
|
||||||
{
|
{
|
||||||
Protect_FPU_rounding<Protection> p;
|
Protect_FPU_rounding<Protection> p;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// No forward here, the arguments may still be needed
|
// No forward here, the arguments may still be needed
|
||||||
auto res = ap(c2a(args)...);
|
auto res = ap(c2a(args)...);
|
||||||
if (is_certain(res))
|
if (is_certain(res))
|
||||||
return get_certain(res);
|
return get_certain(res);
|
||||||
}
|
}
|
||||||
catch (Uncertain_conversion_exception&) {}
|
catch (Uncertain_conversion_exception&) {}
|
||||||
}
|
}
|
||||||
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
||||||
|
|
|
||||||
|
|
@ -30,189 +30,189 @@ namespace CGAL {
|
||||||
// Dim_ real dimension
|
// Dim_ real dimension
|
||||||
// Max_dim_ upper bound on the dimension
|
// Max_dim_ upper bound on the dimension
|
||||||
template<class NT_,class Dim_,class Max_dim_=Dim_> struct LA_eigen {
|
template<class NT_,class Dim_,class Max_dim_=Dim_> struct LA_eigen {
|
||||||
typedef NT_ NT;
|
typedef NT_ NT;
|
||||||
typedef Dim_ Dimension;
|
typedef Dim_ Dimension;
|
||||||
typedef Max_dim_ Max_dimension;
|
typedef Max_dim_ Max_dimension;
|
||||||
enum { dimension = Eigen_dimension<Dimension>::value };
|
enum { dimension = Eigen_dimension<Dimension>::value };
|
||||||
enum { max_dimension = Eigen_dimension<Max_dimension>::value };
|
enum { max_dimension = Eigen_dimension<Max_dimension>::value };
|
||||||
template< class D2, class D3=D2 >
|
template< class D2, class D3=D2 >
|
||||||
struct Rebind_dimension {
|
struct Rebind_dimension {
|
||||||
typedef LA_eigen< NT, D2, D3 > Other;
|
typedef LA_eigen< NT, D2, D3 > Other;
|
||||||
};
|
};
|
||||||
template<class,class=void> struct Property : boost::false_type {};
|
template<class,class=void> struct Property : boost::false_type {};
|
||||||
template<class D> struct Property<Has_vector_plus_minus_tag,D> : boost::true_type {};
|
template<class D> struct Property<Has_vector_plus_minus_tag,D> : boost::true_type {};
|
||||||
template<class D> struct Property<Has_vector_scalar_ops_tag,D> : boost::true_type {};
|
template<class D> struct Property<Has_vector_scalar_ops_tag,D> : boost::true_type {};
|
||||||
template<class D> struct Property<Has_dot_product_tag,D> : boost::true_type {};
|
template<class D> struct Property<Has_dot_product_tag,D> : boost::true_type {};
|
||||||
|
|
||||||
typedef Eigen::Matrix<NT,Eigen_dimension<Dim_>::value,1,Eigen::ColMajor|Eigen::AutoAlign,Eigen_dimension<Max_dim_>::value,1> Vector;
|
typedef Eigen::Matrix<NT,Eigen_dimension<Dim_>::value,1,Eigen::ColMajor|Eigen::AutoAlign,Eigen_dimension<Max_dim_>::value,1> Vector;
|
||||||
typedef Eigen::Matrix<NT,Eigen::Dynamic,1> Dynamic_vector;
|
typedef Eigen::Matrix<NT,Eigen::Dynamic,1> Dynamic_vector;
|
||||||
typedef Construct_eigen<Vector> Construct_vector;
|
typedef Construct_eigen<Vector> Construct_vector;
|
||||||
|
|
||||||
#if (EIGEN_WORLD_VERSION>=3)
|
#if (EIGEN_WORLD_VERSION>=3)
|
||||||
typedef NT const* Vector_const_iterator;
|
typedef NT const* Vector_const_iterator;
|
||||||
#else
|
#else
|
||||||
typedef Iterator_from_indices<const type,const NT> Vector_const_iterator;
|
typedef Iterator_from_indices<const type,const NT> Vector_const_iterator;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<class Vec_>static Vector_const_iterator vector_begin(Vec_ const&a){
|
template<class Vec_>static Vector_const_iterator vector_begin(Vec_ const&a){
|
||||||
#if (EIGEN_WORLD_VERSION>=3)
|
#if (EIGEN_WORLD_VERSION>=3)
|
||||||
return &a[0];
|
return &a[0];
|
||||||
#else
|
#else
|
||||||
return Vector_const_iterator(a,0);
|
return Vector_const_iterator(a,0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Vec_>static Vector_const_iterator vector_end(Vec_ const&a){
|
template<class Vec_>static Vector_const_iterator vector_end(Vec_ const&a){
|
||||||
#if (EIGEN_WORLD_VERSION>=3)
|
#if (EIGEN_WORLD_VERSION>=3)
|
||||||
// FIXME: Isn't that dangerous if a is an expression and not a concrete vector?
|
// FIXME: Isn't that dangerous if a is an expression and not a concrete vector?
|
||||||
return &a[0]+a.size();
|
return &a[0]+a.size();
|
||||||
#else
|
#else
|
||||||
return Vector_const_iterator(a,a.size());
|
return Vector_const_iterator(a,a.size());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef Eigen::Matrix<NT,dimension,dimension,Eigen::ColMajor|Eigen::AutoAlign,max_dimension,max_dimension> Square_matrix;
|
typedef Eigen::Matrix<NT,dimension,dimension,Eigen::ColMajor|Eigen::AutoAlign,max_dimension,max_dimension> Square_matrix;
|
||||||
typedef Eigen::Matrix<NT,dimension,Eigen::Dynamic,Eigen::ColMajor|Eigen::AutoAlign,max_dimension,Eigen::Dynamic> Dynamic_matrix;
|
typedef Eigen::Matrix<NT,dimension,Eigen::Dynamic,Eigen::ColMajor|Eigen::AutoAlign,max_dimension,Eigen::Dynamic> Dynamic_matrix;
|
||||||
//TODO: don't pass on the values of Max_* for an expensive NT
|
//TODO: don't pass on the values of Max_* for an expensive NT
|
||||||
// typedef ... Constructor
|
// typedef ... Constructor
|
||||||
// typedef ... Accessor
|
// typedef ... Accessor
|
||||||
#if 0
|
#if 0
|
||||||
private:
|
private:
|
||||||
template <class T> class Canonicalize_vector {
|
template <class T> class Canonicalize_vector {
|
||||||
typedef typename Dimension_eigen<T::SizeAtCompileTime>::type S1;
|
typedef typename Dimension_eigen<T::SizeAtCompileTime>::type S1;
|
||||||
typedef typename Dimension_eigen<T::MaxSizeAtCompileTime>::type S2;
|
typedef typename Dimension_eigen<T::MaxSizeAtCompileTime>::type S2;
|
||||||
public:
|
public:
|
||||||
typedef typename Vector<S1,S2>::type type;
|
typedef typename Vector<S1,S2>::type type;
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<class Vec_>static int size_of_vector(Vec_ const&v){
|
template<class Vec_>static int size_of_vector(Vec_ const&v){
|
||||||
return (int)v.size();
|
return (int)v.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Vec_>static NT dot_product(Vec_ const&a,Vec_ const&b){
|
template<class Vec_>static NT dot_product(Vec_ const&a,Vec_ const&b){
|
||||||
return a.dot(b);
|
return a.dot(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Vec_> static int rows(Vec_ const&v) {
|
template<class Vec_> static int rows(Vec_ const&v) {
|
||||||
return (int)v.rows();
|
return (int)v.rows();
|
||||||
}
|
}
|
||||||
template<class Vec_> static int columns(Vec_ const&v) {
|
template<class Vec_> static int columns(Vec_ const&v) {
|
||||||
return (int)v.cols();
|
return (int)v.cols();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Mat_> static NT determinant_aux [[noreturn]] (Mat_ const&, Tag_true) {
|
template<class Mat_> static NT determinant_aux [[noreturn]] (Mat_ const&, Tag_true) {
|
||||||
CGAL_error();
|
CGAL_error();
|
||||||
}
|
}
|
||||||
template<class Mat_> static NT determinant_aux(Mat_ const& m, Tag_false) {
|
template<class Mat_> static NT determinant_aux(Mat_ const& m, Tag_false) {
|
||||||
return m.determinant();
|
return m.determinant();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Mat_> static NT determinant(Mat_ const&m,bool=false){
|
template<class Mat_> static NT determinant(Mat_ const&m,bool=false){
|
||||||
switch(m.rows()){
|
switch(m.rows()){
|
||||||
//case 0:
|
//case 0:
|
||||||
// return 1;
|
// return 1;
|
||||||
case 1:
|
case 1:
|
||||||
return m(0,0);
|
return m(0,0);
|
||||||
case 2:
|
case 2:
|
||||||
return CGAL::determinant(
|
return CGAL::determinant(
|
||||||
m(0,0),m(0,1),
|
m(0,0),m(0,1),
|
||||||
m(1,0),m(1,1));
|
m(1,0),m(1,1));
|
||||||
case 3:
|
case 3:
|
||||||
return CGAL::determinant(
|
return CGAL::determinant(
|
||||||
m(0,0),m(0,1),m(0,2),
|
m(0,0),m(0,1),m(0,2),
|
||||||
m(1,0),m(1,1),m(1,2),
|
m(1,0),m(1,1),m(1,2),
|
||||||
m(2,0),m(2,1),m(2,2));
|
m(2,0),m(2,1),m(2,2));
|
||||||
case 4:
|
case 4:
|
||||||
return CGAL::determinant(
|
return CGAL::determinant(
|
||||||
m(0,0),m(0,1),m(0,2),m(0,3),
|
m(0,0),m(0,1),m(0,2),m(0,3),
|
||||||
m(1,0),m(1,1),m(1,2),m(1,3),
|
m(1,0),m(1,1),m(1,2),m(1,3),
|
||||||
m(2,0),m(2,1),m(2,2),m(2,3),
|
m(2,0),m(2,1),m(2,2),m(2,3),
|
||||||
m(3,0),m(3,1),m(3,2),m(3,3));
|
m(3,0),m(3,1),m(3,2),m(3,3));
|
||||||
case 5:
|
case 5:
|
||||||
return CGAL::determinant(
|
return CGAL::determinant(
|
||||||
m(0,0),m(0,1),m(0,2),m(0,3),m(0,4),
|
m(0,0),m(0,1),m(0,2),m(0,3),m(0,4),
|
||||||
m(1,0),m(1,1),m(1,2),m(1,3),m(1,4),
|
m(1,0),m(1,1),m(1,2),m(1,3),m(1,4),
|
||||||
m(2,0),m(2,1),m(2,2),m(2,3),m(2,4),
|
m(2,0),m(2,1),m(2,2),m(2,3),m(2,4),
|
||||||
m(3,0),m(3,1),m(3,2),m(3,3),m(3,4),
|
m(3,0),m(3,1),m(3,2),m(3,3),m(3,4),
|
||||||
m(4,0),m(4,1),m(4,2),m(4,3),m(4,4));
|
m(4,0),m(4,1),m(4,2),m(4,3),m(4,4));
|
||||||
case 6:
|
case 6:
|
||||||
return CGAL::determinant(
|
return CGAL::determinant(
|
||||||
m(0,0),m(0,1),m(0,2),m(0,3),m(0,4),m(0,5),
|
m(0,0),m(0,1),m(0,2),m(0,3),m(0,4),m(0,5),
|
||||||
m(1,0),m(1,1),m(1,2),m(1,3),m(1,4),m(1,5),
|
m(1,0),m(1,1),m(1,2),m(1,3),m(1,4),m(1,5),
|
||||||
m(2,0),m(2,1),m(2,2),m(2,3),m(2,4),m(2,5),
|
m(2,0),m(2,1),m(2,2),m(2,3),m(2,4),m(2,5),
|
||||||
m(3,0),m(3,1),m(3,2),m(3,3),m(3,4),m(3,5),
|
m(3,0),m(3,1),m(3,2),m(3,3),m(3,4),m(3,5),
|
||||||
m(4,0),m(4,1),m(4,2),m(4,3),m(4,4),m(4,5),
|
m(4,0),m(4,1),m(4,2),m(4,3),m(4,4),m(4,5),
|
||||||
m(5,0),m(5,1),m(5,2),m(5,3),m(5,4),m(5,5));
|
m(5,0),m(5,1),m(5,2),m(5,3),m(5,4),m(5,5));
|
||||||
case 7:
|
case 7:
|
||||||
return CGAL::determinant(
|
return CGAL::determinant(
|
||||||
m(0,0),m(0,1),m(0,2),m(0,3),m(0,4),m(0,5),m(0,6),
|
m(0,0),m(0,1),m(0,2),m(0,3),m(0,4),m(0,5),m(0,6),
|
||||||
m(1,0),m(1,1),m(1,2),m(1,3),m(1,4),m(1,5),m(1,6),
|
m(1,0),m(1,1),m(1,2),m(1,3),m(1,4),m(1,5),m(1,6),
|
||||||
m(2,0),m(2,1),m(2,2),m(2,3),m(2,4),m(2,5),m(2,6),
|
m(2,0),m(2,1),m(2,2),m(2,3),m(2,4),m(2,5),m(2,6),
|
||||||
m(3,0),m(3,1),m(3,2),m(3,3),m(3,4),m(3,5),m(3,6),
|
m(3,0),m(3,1),m(3,2),m(3,3),m(3,4),m(3,5),m(3,6),
|
||||||
m(4,0),m(4,1),m(4,2),m(4,3),m(4,4),m(4,5),m(4,6),
|
m(4,0),m(4,1),m(4,2),m(4,3),m(4,4),m(4,5),m(4,6),
|
||||||
m(5,0),m(5,1),m(5,2),m(5,3),m(5,4),m(5,5),m(5,6),
|
m(5,0),m(5,1),m(5,2),m(5,3),m(5,4),m(5,5),m(5,6),
|
||||||
m(6,0),m(6,1),m(6,2),m(6,3),m(6,4),m(6,5),m(6,6));
|
m(6,0),m(6,1),m(6,2),m(6,3),m(6,4),m(6,5),m(6,6));
|
||||||
default:
|
default:
|
||||||
return determinant_aux(m, Boolean_tag<(Mat_::MaxRowsAtCompileTime >= 1 && Mat_::MaxRowsAtCompileTime <= 7)>());
|
return determinant_aux(m, Boolean_tag<(Mat_::MaxRowsAtCompileTime >= 1 && Mat_::MaxRowsAtCompileTime <= 7)>());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Mat_> static typename
|
template<class Mat_> static typename
|
||||||
Same_uncertainty_nt<CGAL::Sign, NT>::type
|
Same_uncertainty_nt<CGAL::Sign, NT>::type
|
||||||
sign_of_determinant(Mat_ const&m,bool=false)
|
sign_of_determinant(Mat_ const&m,bool=false)
|
||||||
{
|
{
|
||||||
return CGAL::sign(LA_eigen::determinant(m));
|
return CGAL::sign(LA_eigen::determinant(m));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Mat_> static int rank(Mat_ const&m){
|
template<class Mat_> static int rank(Mat_ const&m){
|
||||||
// return m.rank();
|
// return m.rank();
|
||||||
// This one uses sqrt so cannot be used with Gmpq
|
// This one uses sqrt so cannot be used with Gmpq
|
||||||
// TODO: use different algo for different NT?
|
// TODO: use different algo for different NT?
|
||||||
// Eigen::ColPivHouseholderQR<Mat_> decomp(m);
|
// Eigen::ColPivHouseholderQR<Mat_> decomp(m);
|
||||||
Eigen::FullPivLU<Mat_> decomp(m);
|
Eigen::FullPivLU<Mat_> decomp(m);
|
||||||
// decomp.setThreshold(0);
|
// decomp.setThreshold(0);
|
||||||
return static_cast<int>(decomp.rank());
|
return static_cast<int>(decomp.rank());
|
||||||
}
|
}
|
||||||
|
|
||||||
// m*a==b
|
// m*a==b
|
||||||
template<class DV, class DM, class V>
|
template<class DV, class DM, class V>
|
||||||
static void solve(DV&a, DM const&m, V const& b){
|
static void solve(DV&a, DM const&m, V const& b){
|
||||||
//a = m.colPivHouseholderQr().solve(b);
|
//a = m.colPivHouseholderQr().solve(b);
|
||||||
a = m.fullPivLu().solve(b);
|
a = m.fullPivLu().solve(b);
|
||||||
}
|
}
|
||||||
template<class DV, class DM, class V>
|
template<class DV, class DM, class V>
|
||||||
static bool solve_and_check(DV&a, DM const&m, V const& b){
|
static bool solve_and_check(DV&a, DM const&m, V const& b){
|
||||||
//a = m.colPivHouseholderQr().solve(b);
|
//a = m.colPivHouseholderQr().solve(b);
|
||||||
a = m.fullPivLu().solve(b);
|
a = m.fullPivLu().solve(b);
|
||||||
return b.isApprox(m*a);
|
return b.isApprox(m*a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Dynamic_matrix basis(Dynamic_matrix const&m){
|
static Dynamic_matrix basis(Dynamic_matrix const&m){
|
||||||
return m.fullPivLu().image(m);
|
return m.fullPivLu().image(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Vec1,class Vec2> static Vector homogeneous_add(Vec1 const&a,Vec2 const&b){
|
template<class Vec1,class Vec2> static Vector homogeneous_add(Vec1 const&a,Vec2 const&b){
|
||||||
//TODO: use compile-time size when available
|
//TODO: use compile-time size when available
|
||||||
int d=a.size();
|
int d=a.size();
|
||||||
Vector v(d);
|
Vector v(d);
|
||||||
v << b[d-1]*a.topRows(d-1)+a[d-1]*b.topRows(d-1), a[d-1]*b[d-1];
|
v << b[d-1]*a.topRows(d-1)+a[d-1]*b.topRows(d-1), a[d-1]*b[d-1];
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Vec1,class Vec2> static Vector homogeneous_sub(Vec1 const&a,Vec2 const&b){
|
template<class Vec1,class Vec2> static Vector homogeneous_sub(Vec1 const&a,Vec2 const&b){
|
||||||
int d=a.size();
|
int d=a.size();
|
||||||
Vector v(d);
|
Vector v(d);
|
||||||
v << b[d-1]*a.topRows(d-1)-a[d-1]*b.topRows(d-1), a[d-1]*b[d-1];
|
v << b[d-1]*a.topRows(d-1)-a[d-1]*b.topRows(d-1), a[d-1]*b[d-1];
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Vec1,class Vec2> static std::pair<NT,NT> homogeneous_dot_product(Vec1 const&a,Vec2 const&b){
|
template<class Vec1,class Vec2> static std::pair<NT,NT> homogeneous_dot_product(Vec1 const&a,Vec2 const&b){
|
||||||
int d=a.size();
|
int d=a.size();
|
||||||
return make_pair(a.topRows(d-1).dot(b.topRows(d-1)), a[d-1]*b[d-1]);
|
return make_pair(a.topRows(d-1).dot(b.topRows(d-1)), a[d-1]*b[d-1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -199,19 +199,19 @@ struct Lazy_cartesian_types
|
||||||
typedef typename typeset_intersection<
|
typedef typename typeset_intersection<
|
||||||
typename AK_::Object_list,
|
typename AK_::Object_list,
|
||||||
typename EK_::Object_list
|
typename EK_::Object_list
|
||||||
>::type Object_list;
|
>::type Object_list;
|
||||||
|
|
||||||
typedef typename typeset_intersection<
|
typedef typename typeset_intersection<
|
||||||
typename AK_::Iterator_list,
|
typename AK_::Iterator_list,
|
||||||
typename EK_::Iterator_list
|
typename EK_::Iterator_list
|
||||||
>::type Iterator_list;
|
>::type Iterator_list;
|
||||||
|
|
||||||
template <class T,class=typename Get_type_category<Kernel_,T>::type> struct Type {};
|
template <class T,class=typename Get_type_category<Kernel_,T>::type> struct Type {};
|
||||||
template <class T> struct Type<T,Object_tag> {
|
template <class T> struct Type<T,Object_tag> {
|
||||||
typedef Lazy<
|
typedef Lazy<
|
||||||
typename Get_type<AK_,T>::type,
|
typename Get_type<AK_,T>::type,
|
||||||
typename Get_type<EK_,T>::type,
|
typename Get_type<EK_,T>::type,
|
||||||
E2A_> type;
|
E2A_> type;
|
||||||
};
|
};
|
||||||
template <class T> struct Type<T,Number_tag> {
|
template <class T> struct Type<T,Number_tag> {
|
||||||
typedef CGAL::Lazy_exact_nt<typename Get_type<EK_,T>::type> type;
|
typedef CGAL::Lazy_exact_nt<typename Get_type<EK_,T>::type> type;
|
||||||
|
|
@ -225,12 +225,12 @@ struct Lazy_cartesian_types
|
||||||
|
|
||||||
// TODO: we should use Lazy_construction2, but this seems ok for now, we never construct iterators from iterators.
|
// TODO: we should use Lazy_construction2, but this seems ok for now, we never construct iterators from iterators.
|
||||||
typedef typename internal::Lazy_construction_maybe_nt<
|
typedef typename internal::Lazy_construction_maybe_nt<
|
||||||
Kernel_, AF, EF, is_NT_tag<Vt>::value
|
Kernel_, AF, EF, is_NT_tag<Vt>::value
|
||||||
>::type nth_elem;
|
>::type nth_elem;
|
||||||
|
|
||||||
typedef Iterator_from_indices<
|
typedef Iterator_from_indices<
|
||||||
const typename Type<typename iterator_tag_traits<T>::container>::type,
|
const typename Type<typename iterator_tag_traits<T>::container>::type,
|
||||||
const V, V, nth_elem
|
const V, V, nth_elem
|
||||||
> type;
|
> type;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -288,39 +288,39 @@ struct Lazy_cartesian :
|
||||||
// Check that Approximate_kernel agrees with all that...
|
// Check that Approximate_kernel agrees with all that...
|
||||||
|
|
||||||
template<class T,class D=void,class=typename Get_functor_category<Lazy_cartesian,T,D>::type> struct Functor {
|
template<class T,class D=void,class=typename Get_functor_category<Lazy_cartesian,T,D>::type> struct Functor {
|
||||||
typedef Null_functor type;
|
typedef Null_functor type;
|
||||||
};
|
};
|
||||||
//FIXME: what do we do with D here?
|
//FIXME: what do we do with D here?
|
||||||
template<class T,class D> struct Functor<T,D,Predicate_tag> {
|
template<class T,class D> struct Functor<T,D,Predicate_tag> {
|
||||||
typedef typename Get_functor<Approximate_kernel, T>::type FA;
|
typedef typename Get_functor<Approximate_kernel, T>::type FA;
|
||||||
typedef typename Get_functor<Exact_kernel, T>::type FE;
|
typedef typename Get_functor<Exact_kernel, T>::type FE;
|
||||||
typedef Filtered_predicate2<Lazy_cartesian,FE,FA,C2E,C2A> type;
|
typedef Filtered_predicate2<Lazy_cartesian,FE,FA,C2E,C2A> type;
|
||||||
};
|
};
|
||||||
template<class T,class D> struct Functor<T,D,Compute_tag> {
|
template<class T,class D> struct Functor<T,D,Compute_tag> {
|
||||||
typedef Lazy_construction2<T,Kernel> type;
|
typedef Lazy_construction2<T,Kernel> type;
|
||||||
};
|
};
|
||||||
template<class T,class D> struct Functor<T,D,Construct_tag> {
|
template<class T,class D> struct Functor<T,D,Construct_tag> {
|
||||||
typedef Lazy_construction2<T,Kernel> type;
|
typedef Lazy_construction2<T,Kernel> type;
|
||||||
};
|
};
|
||||||
template<class D> struct Functor<Point_dimension_tag,D,Misc_tag> {
|
template<class D> struct Functor<Point_dimension_tag,D,Misc_tag> {
|
||||||
typedef typename Get_functor<Approximate_kernel, Point_dimension_tag>::type FA;
|
typedef typename Get_functor<Approximate_kernel, Point_dimension_tag>::type FA;
|
||||||
struct type {
|
struct type {
|
||||||
FA fa;
|
FA fa;
|
||||||
type(){}
|
type(){}
|
||||||
type(Kernel const&k):fa(k.approximate_kernel()){}
|
type(Kernel const&k):fa(k.approximate_kernel()){}
|
||||||
template<class P>
|
template<class P>
|
||||||
int operator()(P const&p)const{return fa(CGAL::approx(p));}
|
int operator()(P const&p)const{return fa(CGAL::approx(p));}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
template<class D> struct Functor<Vector_dimension_tag,D,Misc_tag> {
|
template<class D> struct Functor<Vector_dimension_tag,D,Misc_tag> {
|
||||||
typedef typename Get_functor<Approximate_kernel, Vector_dimension_tag>::type FA;
|
typedef typename Get_functor<Approximate_kernel, Vector_dimension_tag>::type FA;
|
||||||
struct type {
|
struct type {
|
||||||
FA fa;
|
FA fa;
|
||||||
type(){}
|
type(){}
|
||||||
type(Kernel const&k):fa(k.approximate_kernel()){}
|
type(Kernel const&k):fa(k.approximate_kernel()){}
|
||||||
template<class V>
|
template<class V>
|
||||||
int operator()(V const&v)const{return fa(CGAL::approx(v));}
|
int operator()(V const&v)const{return fa(CGAL::approx(v));}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
template<class D> struct Functor<Linear_base_tag,D,Misc_tag> {
|
template<class D> struct Functor<Linear_base_tag,D,Misc_tag> {
|
||||||
// Don't filter that one, as there is no guarantee that the interval
|
// Don't filter that one, as there is no guarantee that the interval
|
||||||
|
|
@ -332,19 +332,19 @@ struct Lazy_cartesian :
|
||||||
typedef typename Get_type<Exact_kernel, Vector_tag>::type ET;
|
typedef typename Get_type<Exact_kernel, Vector_tag>::type ET;
|
||||||
typedef typename Base::template Type<Vector_tag>::type V; // Lazy<AT, ET, E2A>
|
typedef typename Base::template Type<Vector_tag>::type V; // Lazy<AT, ET, E2A>
|
||||||
struct type {
|
struct type {
|
||||||
FE fe;
|
FE fe;
|
||||||
type(){}
|
type(){}
|
||||||
type(Kernel const&k):fe(k.exact_kernel()){}
|
type(Kernel const&k):fe(k.exact_kernel()){}
|
||||||
template<class Iter, class Oter>
|
template<class Iter, class Oter>
|
||||||
void operator()(Iter i, Iter e, Oter o)const{
|
void operator()(Iter i, Iter e, Oter o)const{
|
||||||
fe(CGAL::exact(i), CGAL::exact(e),
|
fe(CGAL::exact(i), CGAL::exact(e),
|
||||||
boost::make_function_output_iterator(
|
boost::make_function_output_iterator(
|
||||||
[&o](ET const&v){
|
[&o](ET const&v){
|
||||||
*o++ = V(new Lazy_rep_0<AT,ET,E2A>(v));
|
*o++ = V(new Lazy_rep_0<AT,ET,E2A>(v));
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -354,22 +354,22 @@ struct Lazy_cartesian :
|
||||||
// This is really specific to point/vector coordinate iterators
|
// This is really specific to point/vector coordinate iterators
|
||||||
template<class U>
|
template<class U>
|
||||||
struct Construct_iter : private Store_kernel<Kernel> {
|
struct Construct_iter : private Store_kernel<Kernel> {
|
||||||
Construct_iter(){}
|
Construct_iter(){}
|
||||||
Construct_iter(Kernel const&k):Store_kernel<Kernel>(k){}
|
Construct_iter(Kernel const&k):Store_kernel<Kernel>(k){}
|
||||||
//FIXME: pass the kernel to the functor in the iterator
|
//FIXME: pass the kernel to the functor in the iterator
|
||||||
typedef U result_type;
|
typedef U result_type;
|
||||||
template<class T>
|
template<class T>
|
||||||
result_type operator()(T const& t,Begin_tag)const{
|
result_type operator()(T const& t,Begin_tag)const{
|
||||||
return result_type(t,0,this->kernel());
|
return result_type(t,0,this->kernel());
|
||||||
}
|
}
|
||||||
template<class T>
|
template<class T>
|
||||||
result_type operator()(T const& t,End_tag)const{
|
result_type operator()(T const& t,End_tag)const{
|
||||||
typedef typename Get_functor<Approximate_kernel, Point_dimension_tag>::type PD;
|
typedef typename Get_functor<Approximate_kernel, Point_dimension_tag>::type PD;
|
||||||
return result_type(t,PD(this->kernel().approximate_kernel())(CGAL::approx(t)),this->kernel());
|
return result_type(t,PD(this->kernel().approximate_kernel())(CGAL::approx(t)),this->kernel());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
template<class T,class D> struct Functor<T,D,Construct_iterator_tag> {
|
template<class T,class D> struct Functor<T,D,Construct_iterator_tag> {
|
||||||
typedef Construct_iter<typename Base::template Iterator<typename map_result_tag<T>::type>::type> type;
|
typedef Construct_iter<typename Base::template Iterator<typename map_result_tag<T>::type>::type> type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,33 +22,33 @@ template<std::size_t,class...> struct Apply_to_last_then_rest_;
|
||||||
|
|
||||||
template<std::size_t d,class F,class T,class... U>
|
template<std::size_t d,class F,class T,class... U>
|
||||||
struct Apply_to_last_then_rest_<d,F,T,U...> {
|
struct Apply_to_last_then_rest_<d,F,T,U...> {
|
||||||
typedef typename Apply_to_last_then_rest_<d-1,F,U...,T>::result_type result_type;
|
typedef typename Apply_to_last_then_rest_<d-1,F,U...,T>::result_type result_type;
|
||||||
inline result_type operator()(F&&f,T&&t,U&&...u)const{
|
inline result_type operator()(F&&f,T&&t,U&&...u)const{
|
||||||
return Apply_to_last_then_rest_<d-1,F,U...,T>()(
|
return Apply_to_last_then_rest_<d-1,F,U...,T>()(
|
||||||
std::forward<F>(f),
|
std::forward<F>(f),
|
||||||
std::forward<U>(u)...,
|
std::forward<U>(u)...,
|
||||||
std::forward<T>(t));
|
std::forward<T>(t));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class F,class T,class... U>
|
template<class F,class T,class... U>
|
||||||
struct Apply_to_last_then_rest_<0,F,T,U...> {
|
struct Apply_to_last_then_rest_<0,F,T,U...> {
|
||||||
typedef decltype(std::declval<F>()(std::declval<T>(), std::declval<U>()...)) result_type;
|
typedef decltype(std::declval<F>()(std::declval<T>(), std::declval<U>()...)) result_type;
|
||||||
inline result_type operator()(F&&f,T&&t,U&&...u)const{
|
inline result_type operator()(F&&f,T&&t,U&&...u)const{
|
||||||
return std::forward<F>(f)(std::forward<T>(t), std::forward<U>(u)...);
|
return std::forward<F>(f)(std::forward<T>(t), std::forward<U>(u)...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
struct Apply_to_last_then_rest {
|
struct Apply_to_last_then_rest {
|
||||||
template<class F,class T,class...U> inline
|
template<class F,class T,class...U> inline
|
||||||
typename internal::Apply_to_last_then_rest_<sizeof...(U),F,T,U...>::result_type
|
typename internal::Apply_to_last_then_rest_<sizeof...(U),F,T,U...>::result_type
|
||||||
operator()(F&&f,T&&t,U&&...u)const{
|
operator()(F&&f,T&&t,U&&...u)const{
|
||||||
return internal::Apply_to_last_then_rest_<sizeof...(U),F,T,U...>()(
|
return internal::Apply_to_last_then_rest_<sizeof...(U),F,T,U...>()(
|
||||||
std::forward<F>(f),
|
std::forward<F>(f),
|
||||||
std::forward<T>(t),
|
std::forward<T>(t),
|
||||||
std::forward<U>(u)...);
|
std::forward<U>(u)...);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ namespace CGAL {
|
||||||
std::conditional<
|
std::conditional<
|
||||||
contains<X>::value,
|
contains<X>::value,
|
||||||
typeset<H,U...>,
|
typeset<H,U...>,
|
||||||
typeset<H,U...,X>
|
typeset<H,U...,X>
|
||||||
>::type;
|
>::type;
|
||||||
};
|
};
|
||||||
template<> struct typeset<> {
|
template<> struct typeset<> {
|
||||||
|
|
@ -58,8 +58,8 @@ namespace CGAL {
|
||||||
typedef typename T1::head H;
|
typedef typename T1::head H;
|
||||||
typedef typename typeset_intersection_<typename T1::tail,T2>::type U;
|
typedef typename typeset_intersection_<typename T1::tail,T2>::type U;
|
||||||
typedef typename
|
typedef typename
|
||||||
std::conditional<T2::template contains<H>::value,
|
std::conditional<T2::template contains<H>::value,
|
||||||
typename U::template add<H>::type, U>::type type;
|
typename U::template add<H>::type, U>::type type;
|
||||||
};
|
};
|
||||||
template<class T> struct typeset_intersection_<typeset<>, T> : typeset<> {};
|
template<class T> struct typeset_intersection_<typeset<>, T> : typeset<> {};
|
||||||
template<class T> struct typeset_intersection_<typeset_all, T> : T {};
|
template<class T> struct typeset_intersection_<typeset_all, T> : T {};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue