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
|
|
@ -1,16 +1,16 @@
|
|||
// Copyright (c) 1999
|
||||
// Copyright (c) 1999
|
||||
// Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland),
|
||||
// INRIA Sophia-Antipolis (France),
|
||||
// Max-Planck-Institute Saarbruecken (Germany),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org)
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Sylvain Pion
|
||||
// Stefan Schirra
|
||||
|
|
@ -227,7 +227,7 @@ determinant(
|
|||
a41, a42, a43, a44, a45, a46,
|
||||
a51, a52, a53, a54, a55, a56,
|
||||
a61, a62, a63, a64, a65, a66)
|
||||
|
||||
|
||||
- a10 * determinant(a01, a02, a03, a04, a05, a06,
|
||||
|
||||
a21, a22, a23, a24, a25, a26,
|
||||
|
|
@ -235,7 +235,7 @@ determinant(
|
|||
a41, a42, a43, a44, a45, a46,
|
||||
a51, a52, a53, a54, a55, a56,
|
||||
a61, a62, a63, a64, a65, a66)
|
||||
|
||||
|
||||
+ a20 * determinant(a01, a02, a03, a04, a05, a06,
|
||||
a11, a12, a13, a14, a15, a16,
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ determinant(
|
|||
a41, a42, a43, a44, a45, a46,
|
||||
a51, a52, a53, a54, a55, a56,
|
||||
a61, a62, a63, a64, a65, a66)
|
||||
|
||||
|
||||
- a30 * determinant(a01, a02, a03, a04, a05, a06,
|
||||
a11, a12, a13, a14, a15, a16,
|
||||
a21, a22, a23, a24, a25, a26,
|
||||
|
|
@ -251,7 +251,7 @@ determinant(
|
|||
a41, a42, a43, a44, a45, a46,
|
||||
a51, a52, a53, a54, a55, a56,
|
||||
a61, a62, a63, a64, a65, a66)
|
||||
|
||||
|
||||
+ a40 * determinant(a01, a02, a03, a04, a05, a06,
|
||||
a11, a12, a13, a14, a15, a16,
|
||||
a21, a22, a23, a24, a25, a26,
|
||||
|
|
@ -259,15 +259,15 @@ determinant(
|
|||
|
||||
a51, a52, a53, a54, a55, a56,
|
||||
a61, a62, a63, a64, a65, a66)
|
||||
|
||||
|
||||
- a50 * determinant(a01, a02, a03, a04, a05, a06,
|
||||
a11, a12, a13, a14, a15, a16,
|
||||
a21, a22, a23, a24, a25, a26,
|
||||
a31, a32, a33, a34, a35, a36,
|
||||
a41, a42, a43, a44, a45, a46,
|
||||
|
||||
|
||||
a61, a62, a63, a64, a65, a66)
|
||||
|
||||
|
||||
+ a60 * determinant(a01, a02, a03, a04, a05, a06,
|
||||
a11, a12, a13, a14, a15, a16,
|
||||
a21, a22, a23, a24, a25, a26,
|
||||
|
|
@ -278,7 +278,7 @@ determinant(
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_DETERMINANT_H
|
||||
|
|
|
|||
|
|
@ -27,266 +27,266 @@ namespace CartesianDVectorBase {
|
|||
template<class R_,class Zero_> struct Construct_LA_vector
|
||||
: private Store_kernel<R_>
|
||||
{
|
||||
//CGAL_FUNCTOR_INIT_IGNORE(Construct_LA_vector)
|
||||
CGAL_FUNCTOR_INIT_STORE(Construct_LA_vector)
|
||||
typedef R_ R;
|
||||
typedef typename R::Constructor Constructor;
|
||||
typedef typename Get_type<R, RT_tag>::type RT;
|
||||
typedef typename Get_type<R, FT_tag>::type FT;
|
||||
typedef typename R::Vector_ result_type;
|
||||
typedef typename R_::Default_ambient_dimension Dimension;
|
||||
result_type operator()(int d)const{
|
||||
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
||||
return typename Constructor::Dimension()(d);
|
||||
}
|
||||
result_type operator()()const{
|
||||
return typename Constructor::Dimension()((std::max)(0,this->kernel().dimension()));
|
||||
}
|
||||
result_type operator()(int d, Zero_ const&)const{
|
||||
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
||||
return typename Constructor::Dimension()(d);
|
||||
}
|
||||
result_type operator()(Zero_ const&)const{
|
||||
// Makes no sense for an unknown dimension.
|
||||
return typename Constructor::Dimension()(this->kernel().dimension());
|
||||
}
|
||||
result_type operator()(result_type const& v)const{
|
||||
return v;
|
||||
}
|
||||
result_type operator()(result_type&& v)const{
|
||||
return std::move(v);
|
||||
}
|
||||
template<class...U>
|
||||
typename std::enable_if<Constructible_from_each<RT,U...>::value &&
|
||||
std::is_same<Dimension_tag<int(sizeof...(U))>, Dimension>::value,
|
||||
result_type>::type
|
||||
operator()(U&&...u)const{
|
||||
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>
|
||||
typename std::enable_if<Constructible_from_each<RT,U...>::value &&
|
||||
std::is_same<Dimension_tag<int(sizeof...(U)-1)>, Dimension>::value,
|
||||
result_type>::type
|
||||
operator()(U&&...u)const{
|
||||
return Apply_to_last_then_rest()(typename Constructor::Values_divide(),std::forward<U>(u)...);
|
||||
}
|
||||
template<class Iter> inline
|
||||
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
|
||||
{
|
||||
return this->operator()((int)std::distance(f,g),f,g,t);
|
||||
}
|
||||
template<class Iter> inline
|
||||
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
|
||||
{
|
||||
CGAL_assertion(d==std::distance(f,g));
|
||||
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
||||
return typename Constructor::Iterator()(d,f,g);
|
||||
}
|
||||
template<class Iter> inline
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::bidirectional_iterator_tag>::value,result_type> operator()
|
||||
(Iter f,Iter g,Homogeneous_tag)const
|
||||
{
|
||||
--g;
|
||||
return this->operator()((int)std::distance(f,g),f,g,*g);
|
||||
}
|
||||
template<class Iter> inline
|
||||
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
|
||||
{
|
||||
--g;
|
||||
return this->operator()(d,f,g,*g);
|
||||
}
|
||||
template<class Iter> inline
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||
(Iter f,Iter g)const
|
||||
{
|
||||
// Shouldn't it try comparing dist(f,g) to the dimension if it is known?
|
||||
return this->operator()(f,g,typename R::Rep_tag());
|
||||
}
|
||||
template<class Iter> inline
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||
(int d,Iter f,Iter g)const
|
||||
{
|
||||
return this->operator()(d,f,g,typename R::Rep_tag());
|
||||
}
|
||||
//CGAL_FUNCTOR_INIT_IGNORE(Construct_LA_vector)
|
||||
CGAL_FUNCTOR_INIT_STORE(Construct_LA_vector)
|
||||
typedef R_ R;
|
||||
typedef typename R::Constructor Constructor;
|
||||
typedef typename Get_type<R, RT_tag>::type RT;
|
||||
typedef typename Get_type<R, FT_tag>::type FT;
|
||||
typedef typename R::Vector_ result_type;
|
||||
typedef typename R_::Default_ambient_dimension Dimension;
|
||||
result_type operator()(int d)const{
|
||||
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
||||
return typename Constructor::Dimension()(d);
|
||||
}
|
||||
result_type operator()()const{
|
||||
return typename Constructor::Dimension()((std::max)(0,this->kernel().dimension()));
|
||||
}
|
||||
result_type operator()(int d, Zero_ const&)const{
|
||||
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
||||
return typename Constructor::Dimension()(d);
|
||||
}
|
||||
result_type operator()(Zero_ const&)const{
|
||||
// Makes no sense for an unknown dimension.
|
||||
return typename Constructor::Dimension()(this->kernel().dimension());
|
||||
}
|
||||
result_type operator()(result_type const& v)const{
|
||||
return v;
|
||||
}
|
||||
result_type operator()(result_type&& v)const{
|
||||
return std::move(v);
|
||||
}
|
||||
template<class...U>
|
||||
typename std::enable_if<Constructible_from_each<RT,U...>::value &&
|
||||
std::is_same<Dimension_tag<int(sizeof...(U))>, Dimension>::value,
|
||||
result_type>::type
|
||||
operator()(U&&...u)const{
|
||||
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>
|
||||
typename std::enable_if<Constructible_from_each<RT,U...>::value &&
|
||||
std::is_same<Dimension_tag<int(sizeof...(U)-1)>, Dimension>::value,
|
||||
result_type>::type
|
||||
operator()(U&&...u)const{
|
||||
return Apply_to_last_then_rest()(typename Constructor::Values_divide(),std::forward<U>(u)...);
|
||||
}
|
||||
template<class Iter> inline
|
||||
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
|
||||
{
|
||||
return this->operator()((int)std::distance(f,g),f,g,t);
|
||||
}
|
||||
template<class Iter> inline
|
||||
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
|
||||
{
|
||||
CGAL_assertion(d==std::distance(f,g));
|
||||
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
||||
return typename Constructor::Iterator()(d,f,g);
|
||||
}
|
||||
template<class Iter> inline
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::bidirectional_iterator_tag>::value,result_type> operator()
|
||||
(Iter f,Iter g,Homogeneous_tag)const
|
||||
{
|
||||
--g;
|
||||
return this->operator()((int)std::distance(f,g),f,g,*g);
|
||||
}
|
||||
template<class Iter> inline
|
||||
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
|
||||
{
|
||||
--g;
|
||||
return this->operator()(d,f,g,*g);
|
||||
}
|
||||
template<class Iter> inline
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||
(Iter f,Iter g)const
|
||||
{
|
||||
// Shouldn't it try comparing dist(f,g) to the dimension if it is known?
|
||||
return this->operator()(f,g,typename R::Rep_tag());
|
||||
}
|
||||
template<class Iter> inline
|
||||
typename std::enable_if_t<is_iterator_type<Iter,std::forward_iterator_tag>::value,result_type> operator()
|
||||
(int d,Iter f,Iter g)const
|
||||
{
|
||||
return this->operator()(d,f,g,typename R::Rep_tag());
|
||||
}
|
||||
|
||||
// Last homogeneous coordinate given separately
|
||||
template<class Iter,class NT> inline
|
||||
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
|
||||
{
|
||||
CGAL_assertion(d==std::distance(f,g));
|
||||
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
||||
// 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)));
|
||||
}
|
||||
template<class Iter,class NT> inline
|
||||
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
|
||||
{
|
||||
return this->operator()((int)std::distance(f,g),f,g,l);
|
||||
}
|
||||
// Last homogeneous coordinate given separately
|
||||
template<class Iter,class NT> inline
|
||||
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
|
||||
{
|
||||
CGAL_assertion(d==std::distance(f,g));
|
||||
CGAL_assertion(check_dimension_eq(d,this->kernel().dimension()));
|
||||
// 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)));
|
||||
}
|
||||
template<class Iter,class NT> inline
|
||||
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
|
||||
{
|
||||
return this->operator()((int)std::distance(f,g),f,g,l);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct Compute_cartesian_coordinate {
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Compute_cartesian_coordinate)
|
||||
typedef R_ R;
|
||||
typedef typename Get_type<R, RT_tag>::type RT;
|
||||
typedef typename R::Vector_ first_argument_type;
|
||||
typedef int second_argument_type;
|
||||
typedef Tag_true Is_exact;
|
||||
typedef decltype(std::declval<const first_argument_type>()[0]) result_type;
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Compute_cartesian_coordinate)
|
||||
typedef R_ R;
|
||||
typedef typename Get_type<R, RT_tag>::type RT;
|
||||
typedef typename R::Vector_ first_argument_type;
|
||||
typedef int second_argument_type;
|
||||
typedef Tag_true Is_exact;
|
||||
typedef decltype(std::declval<const first_argument_type>()[0]) result_type;
|
||||
|
||||
template <typename index_type>
|
||||
result_type operator()(first_argument_type const& v,index_type i)const{
|
||||
return v[i];
|
||||
}
|
||||
template <typename index_type>
|
||||
result_type operator()(first_argument_type const& v,index_type i)const{
|
||||
return v[i];
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> 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::LA_vector S_;
|
||||
typedef typename R::Point_cartesian_const_iterator result_type;
|
||||
// same as Vector
|
||||
typedef Tag_true Is_exact;
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Construct_cartesian_const_iterator)
|
||||
typedef R_ R;
|
||||
typedef typename R::Vector_ argument_type;
|
||||
typedef typename R::LA_vector S_;
|
||||
typedef typename R::Point_cartesian_const_iterator result_type;
|
||||
// same as Vector
|
||||
typedef Tag_true Is_exact;
|
||||
|
||||
result_type operator()(argument_type const& v,Begin_tag)const{
|
||||
return S_::vector_begin(v);
|
||||
}
|
||||
result_type operator()(argument_type const& v,End_tag)const{
|
||||
return S_::vector_end(v);
|
||||
}
|
||||
result_type operator()(argument_type const& v,Begin_tag)const{
|
||||
return S_::vector_begin(v);
|
||||
}
|
||||
result_type operator()(argument_type const& v,End_tag)const{
|
||||
return S_::vector_end(v);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct Midpoint {
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Midpoint)
|
||||
typedef R_ R;
|
||||
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 result_type;
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Midpoint)
|
||||
typedef R_ R;
|
||||
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 result_type;
|
||||
|
||||
result_type operator()(result_type const& a, result_type const& b)const{
|
||||
return (a+b)/2;
|
||||
}
|
||||
result_type operator()(result_type const& a, result_type const& b)const{
|
||||
return (a+b)/2;
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct Sum_of_vectors {
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Sum_of_vectors)
|
||||
typedef R_ R;
|
||||
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 result_type;
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Sum_of_vectors)
|
||||
typedef R_ R;
|
||||
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 result_type;
|
||||
|
||||
result_type operator()(result_type const& a, result_type const& b)const{
|
||||
return a+b;
|
||||
}
|
||||
result_type operator()(result_type const& a, result_type const& b)const{
|
||||
return a+b;
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct Difference_of_vectors {
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Difference_of_vectors)
|
||||
typedef R_ R;
|
||||
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 result_type;
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Difference_of_vectors)
|
||||
typedef R_ R;
|
||||
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 result_type;
|
||||
|
||||
result_type operator()(result_type const& a, result_type const& b)const{
|
||||
return a-b;
|
||||
}
|
||||
result_type operator()(result_type const& a, result_type const& b)const{
|
||||
return a-b;
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct Opposite_vector {
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Opposite_vector)
|
||||
typedef R_ R;
|
||||
typedef typename Get_type<R, Vector_tag>::type result_type;
|
||||
typedef typename Get_type<R, Vector_tag>::type argument_type;
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Opposite_vector)
|
||||
typedef R_ R;
|
||||
typedef typename Get_type<R, Vector_tag>::type result_type;
|
||||
typedef typename Get_type<R, Vector_tag>::type argument_type;
|
||||
|
||||
result_type operator()(result_type const& v)const{
|
||||
return -v;
|
||||
}
|
||||
result_type operator()(result_type const& v)const{
|
||||
return -v;
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct Scalar_product {
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Scalar_product)
|
||||
typedef R_ R;
|
||||
typedef typename R::LA_vector LA;
|
||||
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 second_argument_type;
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Scalar_product)
|
||||
typedef R_ R;
|
||||
typedef typename R::LA_vector LA;
|
||||
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 second_argument_type;
|
||||
|
||||
result_type operator()(first_argument_type const& a, second_argument_type const& b)const{
|
||||
return LA::dot_product(a,b);
|
||||
}
|
||||
result_type operator()(first_argument_type const& a, second_argument_type const& b)const{
|
||||
return LA::dot_product(a,b);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct Squared_distance_to_origin_stored {
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Squared_distance_to_origin_stored)
|
||||
typedef R_ R;
|
||||
typedef typename R::LA_vector LA;
|
||||
typedef typename Get_type<R, RT_tag>::type result_type;
|
||||
typedef typename Get_type<R, Point_tag>::type argument_type;
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Squared_distance_to_origin_stored)
|
||||
typedef R_ R;
|
||||
typedef typename R::LA_vector LA;
|
||||
typedef typename Get_type<R, RT_tag>::type result_type;
|
||||
typedef typename Get_type<R, Point_tag>::type argument_type;
|
||||
|
||||
result_type operator()(argument_type const& a)const{
|
||||
return LA::squared_norm(a);
|
||||
}
|
||||
result_type operator()(argument_type const& a)const{
|
||||
return LA::squared_norm(a);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct Squared_distance_to_origin_via_dotprod {
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Squared_distance_to_origin_via_dotprod)
|
||||
typedef R_ R;
|
||||
typedef typename R::LA_vector LA;
|
||||
typedef typename Get_type<R, RT_tag>::type result_type;
|
||||
typedef typename Get_type<R, Point_tag>::type argument_type;
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Squared_distance_to_origin_via_dotprod)
|
||||
typedef R_ R;
|
||||
typedef typename R::LA_vector LA;
|
||||
typedef typename Get_type<R, RT_tag>::type result_type;
|
||||
typedef typename Get_type<R, Point_tag>::type argument_type;
|
||||
|
||||
result_type operator()(argument_type const& a)const{
|
||||
return LA::dot_product(a,a);
|
||||
}
|
||||
result_type operator()(argument_type const& a)const{
|
||||
return LA::dot_product(a,a);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct Orientation_of_vectors {
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Orientation_of_vectors)
|
||||
typedef R_ R;
|
||||
typedef typename R::Vector_cartesian_const_iterator first_argument_type;
|
||||
typedef typename R::Vector_cartesian_const_iterator second_argument_type;
|
||||
typedef typename Get_type<R, Orientation_tag>::type result_type;
|
||||
typedef typename R::LA_vector LA;
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Orientation_of_vectors)
|
||||
typedef R_ R;
|
||||
typedef typename R::Vector_cartesian_const_iterator first_argument_type;
|
||||
typedef typename R::Vector_cartesian_const_iterator second_argument_type;
|
||||
typedef typename Get_type<R, Orientation_tag>::type result_type;
|
||||
typedef typename R::LA_vector LA;
|
||||
|
||||
template<class Iter>
|
||||
result_type operator()(Iter const& f, Iter const& e) const {
|
||||
return LA::determinant_of_iterators_to_vectors(f,e);
|
||||
}
|
||||
template<class Iter>
|
||||
result_type operator()(Iter const& f, Iter const& e) const {
|
||||
return LA::determinant_of_iterators_to_vectors(f,e);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct Orientation_of_points {
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Orientation_of_points)
|
||||
typedef R_ R;
|
||||
typedef typename R::Point_cartesian_const_iterator first_argument_type;
|
||||
typedef typename R::Point_cartesian_const_iterator second_argument_type;
|
||||
typedef typename Get_type<R, Orientation_tag>::type result_type;
|
||||
typedef typename R::LA_vector LA;
|
||||
CGAL_FUNCTOR_INIT_IGNORE(Orientation_of_points)
|
||||
typedef R_ R;
|
||||
typedef typename R::Point_cartesian_const_iterator first_argument_type;
|
||||
typedef typename R::Point_cartesian_const_iterator second_argument_type;
|
||||
typedef typename Get_type<R, Orientation_tag>::type result_type;
|
||||
typedef typename R::LA_vector LA;
|
||||
|
||||
template<class Iter>
|
||||
result_type operator()(Iter const& f, Iter const& e) const {
|
||||
return LA::determinant_of_iterators_to_points(f,e);
|
||||
}
|
||||
template<class Iter>
|
||||
result_type operator()(Iter const& f, Iter const& e) const {
|
||||
return LA::determinant_of_iterators_to_points(f,e);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct PV_dimension {
|
||||
CGAL_FUNCTOR_INIT_IGNORE(PV_dimension)
|
||||
typedef R_ R;
|
||||
typedef typename R::Vector_ argument_type;
|
||||
typedef int result_type;
|
||||
typedef typename R::LA_vector LA;
|
||||
typedef Tag_true Is_exact;
|
||||
CGAL_FUNCTOR_INIT_IGNORE(PV_dimension)
|
||||
typedef R_ R;
|
||||
typedef typename R::Vector_ argument_type;
|
||||
typedef int result_type;
|
||||
typedef typename R::LA_vector LA;
|
||||
typedef Tag_true Is_exact;
|
||||
|
||||
template<class T>
|
||||
result_type operator()(T const& v) const {
|
||||
return LA::size_of_vector(v);
|
||||
}
|
||||
template<class T>
|
||||
result_type operator()(T const& v) const {
|
||||
return LA::size_of_vector(v);
|
||||
}
|
||||
};
|
||||
|
||||
template<class R_> struct Identity_functor {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ template<> struct Functors_without_division<Dimension_tag<5> > {
|
|||
template<> struct Functors_without_division<Dimension_tag<6> > {
|
||||
typedef typeset<Orientation_of_points_tag, Side_of_oriented_sphere_tag> type;
|
||||
};
|
||||
|
||||
|
||||
template < typename Base_, typename AK_, typename EK_, typename Pred_list = typeset_all >
|
||||
struct Cartesian_filter_K : public Base_,
|
||||
private Store_kernel<EK_>
|
||||
|
|
@ -81,7 +81,7 @@ struct Cartesian_filter_K : public Base_,
|
|||
};
|
||||
// TODO:
|
||||
// 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:
|
||||
// detect when Less_cartesian_coordinate doesn't need filtering
|
||||
};
|
||||
|
|
|
|||
|
|
@ -78,12 +78,12 @@ public:
|
|||
{
|
||||
Protect_FPU_rounding<Protection> p;
|
||||
try
|
||||
{
|
||||
// No forward here, the arguments may still be needed
|
||||
auto res = ap(c2a(args)...);
|
||||
if (is_certain(res))
|
||||
return get_certain(res);
|
||||
}
|
||||
{
|
||||
// No forward here, the arguments may still be needed
|
||||
auto res = ap(c2a(args)...);
|
||||
if (is_certain(res))
|
||||
return get_certain(res);
|
||||
}
|
||||
catch (Uncertain_conversion_exception&) {}
|
||||
}
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
||||
|
|
|
|||
|
|
@ -30,189 +30,189 @@ namespace CGAL {
|
|||
// Dim_ real dimension
|
||||
// Max_dim_ upper bound on the dimension
|
||||
template<class NT_,class Dim_,class Max_dim_=Dim_> struct LA_eigen {
|
||||
typedef NT_ NT;
|
||||
typedef Dim_ Dimension;
|
||||
typedef Max_dim_ Max_dimension;
|
||||
enum { dimension = Eigen_dimension<Dimension>::value };
|
||||
enum { max_dimension = Eigen_dimension<Max_dimension>::value };
|
||||
template< class D2, class D3=D2 >
|
||||
struct Rebind_dimension {
|
||||
typedef LA_eigen< NT, D2, D3 > Other;
|
||||
};
|
||||
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_scalar_ops_tag,D> : boost::true_type {};
|
||||
template<class D> struct Property<Has_dot_product_tag,D> : boost::true_type {};
|
||||
typedef NT_ NT;
|
||||
typedef Dim_ Dimension;
|
||||
typedef Max_dim_ Max_dimension;
|
||||
enum { dimension = Eigen_dimension<Dimension>::value };
|
||||
enum { max_dimension = Eigen_dimension<Max_dimension>::value };
|
||||
template< class D2, class D3=D2 >
|
||||
struct Rebind_dimension {
|
||||
typedef LA_eigen< NT, D2, D3 > Other;
|
||||
};
|
||||
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_scalar_ops_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::Dynamic,1> Dynamic_vector;
|
||||
typedef Construct_eigen<Vector> Construct_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 Construct_eigen<Vector> Construct_vector;
|
||||
|
||||
#if (EIGEN_WORLD_VERSION>=3)
|
||||
typedef NT const* Vector_const_iterator;
|
||||
typedef NT const* Vector_const_iterator;
|
||||
#else
|
||||
typedef Iterator_from_indices<const type,const NT> Vector_const_iterator;
|
||||
typedef Iterator_from_indices<const type,const NT> Vector_const_iterator;
|
||||
#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)
|
||||
return &a[0];
|
||||
return &a[0];
|
||||
#else
|
||||
return Vector_const_iterator(a,0);
|
||||
return Vector_const_iterator(a,0);
|
||||
#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)
|
||||
// FIXME: Isn't that dangerous if a is an expression and not a concrete vector?
|
||||
return &a[0]+a.size();
|
||||
// FIXME: Isn't that dangerous if a is an expression and not a concrete vector?
|
||||
return &a[0]+a.size();
|
||||
#else
|
||||
return Vector_const_iterator(a,a.size());
|
||||
return Vector_const_iterator(a,a.size());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
//TODO: don't pass on the values of Max_* for an expensive NT
|
||||
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;
|
||||
//TODO: don't pass on the values of Max_* for an expensive NT
|
||||
// typedef ... Constructor
|
||||
// typedef ... Accessor
|
||||
#if 0
|
||||
private:
|
||||
template <class T> class Canonicalize_vector {
|
||||
typedef typename Dimension_eigen<T::SizeAtCompileTime>::type S1;
|
||||
typedef typename Dimension_eigen<T::MaxSizeAtCompileTime>::type S2;
|
||||
public:
|
||||
typedef typename Vector<S1,S2>::type type;
|
||||
};
|
||||
public:
|
||||
private:
|
||||
template <class T> class Canonicalize_vector {
|
||||
typedef typename Dimension_eigen<T::SizeAtCompileTime>::type S1;
|
||||
typedef typename Dimension_eigen<T::MaxSizeAtCompileTime>::type S2;
|
||||
public:
|
||||
typedef typename Vector<S1,S2>::type type;
|
||||
};
|
||||
public:
|
||||
#endif
|
||||
|
||||
template<class Vec_>static int size_of_vector(Vec_ const&v){
|
||||
return (int)v.size();
|
||||
}
|
||||
template<class Vec_>static int size_of_vector(Vec_ const&v){
|
||||
return (int)v.size();
|
||||
}
|
||||
|
||||
template<class Vec_>static NT dot_product(Vec_ const&a,Vec_ const&b){
|
||||
return a.dot(b);
|
||||
}
|
||||
template<class Vec_>static NT dot_product(Vec_ const&a,Vec_ const&b){
|
||||
return a.dot(b);
|
||||
}
|
||||
|
||||
template<class Vec_> static int rows(Vec_ const&v) {
|
||||
return (int)v.rows();
|
||||
}
|
||||
template<class Vec_> static int columns(Vec_ const&v) {
|
||||
return (int)v.cols();
|
||||
}
|
||||
template<class Vec_> static int rows(Vec_ const&v) {
|
||||
return (int)v.rows();
|
||||
}
|
||||
template<class Vec_> static int columns(Vec_ const&v) {
|
||||
return (int)v.cols();
|
||||
}
|
||||
|
||||
template<class Mat_> static NT determinant_aux [[noreturn]] (Mat_ const&, Tag_true) {
|
||||
CGAL_error();
|
||||
}
|
||||
template<class Mat_> static NT determinant_aux(Mat_ const& m, Tag_false) {
|
||||
return m.determinant();
|
||||
}
|
||||
|
||||
template<class Mat_> static NT determinant(Mat_ const&m,bool=false){
|
||||
switch(m.rows()){
|
||||
//case 0:
|
||||
// return 1;
|
||||
case 1:
|
||||
return m(0,0);
|
||||
case 2:
|
||||
return CGAL::determinant(
|
||||
m(0,0),m(0,1),
|
||||
m(1,0),m(1,1));
|
||||
case 3:
|
||||
return CGAL::determinant(
|
||||
m(0,0),m(0,1),m(0,2),
|
||||
m(1,0),m(1,1),m(1,2),
|
||||
m(2,0),m(2,1),m(2,2));
|
||||
case 4:
|
||||
return CGAL::determinant(
|
||||
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(2,0),m(2,1),m(2,2),m(2,3),
|
||||
m(3,0),m(3,1),m(3,2),m(3,3));
|
||||
case 5:
|
||||
return CGAL::determinant(
|
||||
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(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(4,0),m(4,1),m(4,2),m(4,3),m(4,4));
|
||||
case 6:
|
||||
return CGAL::determinant(
|
||||
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(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(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));
|
||||
case 7:
|
||||
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(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(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(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));
|
||||
default:
|
||||
template<class Mat_> static NT determinant_aux [[noreturn]] (Mat_ const&, Tag_true) {
|
||||
CGAL_error();
|
||||
}
|
||||
template<class Mat_> static NT determinant_aux(Mat_ const& m, Tag_false) {
|
||||
return m.determinant();
|
||||
}
|
||||
|
||||
template<class Mat_> static NT determinant(Mat_ const&m,bool=false){
|
||||
switch(m.rows()){
|
||||
//case 0:
|
||||
// return 1;
|
||||
case 1:
|
||||
return m(0,0);
|
||||
case 2:
|
||||
return CGAL::determinant(
|
||||
m(0,0),m(0,1),
|
||||
m(1,0),m(1,1));
|
||||
case 3:
|
||||
return CGAL::determinant(
|
||||
m(0,0),m(0,1),m(0,2),
|
||||
m(1,0),m(1,1),m(1,2),
|
||||
m(2,0),m(2,1),m(2,2));
|
||||
case 4:
|
||||
return CGAL::determinant(
|
||||
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(2,0),m(2,1),m(2,2),m(2,3),
|
||||
m(3,0),m(3,1),m(3,2),m(3,3));
|
||||
case 5:
|
||||
return CGAL::determinant(
|
||||
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(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(4,0),m(4,1),m(4,2),m(4,3),m(4,4));
|
||||
case 6:
|
||||
return CGAL::determinant(
|
||||
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(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(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));
|
||||
case 7:
|
||||
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(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(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(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));
|
||||
default:
|
||||
return determinant_aux(m, Boolean_tag<(Mat_::MaxRowsAtCompileTime >= 1 && Mat_::MaxRowsAtCompileTime <= 7)>());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class Mat_> static typename
|
||||
Same_uncertainty_nt<CGAL::Sign, NT>::type
|
||||
sign_of_determinant(Mat_ const&m,bool=false)
|
||||
{
|
||||
return CGAL::sign(LA_eigen::determinant(m));
|
||||
}
|
||||
template<class Mat_> static typename
|
||||
Same_uncertainty_nt<CGAL::Sign, NT>::type
|
||||
sign_of_determinant(Mat_ const&m,bool=false)
|
||||
{
|
||||
return CGAL::sign(LA_eigen::determinant(m));
|
||||
}
|
||||
|
||||
template<class Mat_> static int rank(Mat_ const&m){
|
||||
// return m.rank();
|
||||
// This one uses sqrt so cannot be used with Gmpq
|
||||
// TODO: use different algo for different NT?
|
||||
// Eigen::ColPivHouseholderQR<Mat_> decomp(m);
|
||||
Eigen::FullPivLU<Mat_> decomp(m);
|
||||
// decomp.setThreshold(0);
|
||||
return static_cast<int>(decomp.rank());
|
||||
}
|
||||
template<class Mat_> static int rank(Mat_ const&m){
|
||||
// return m.rank();
|
||||
// This one uses sqrt so cannot be used with Gmpq
|
||||
// TODO: use different algo for different NT?
|
||||
// Eigen::ColPivHouseholderQR<Mat_> decomp(m);
|
||||
Eigen::FullPivLU<Mat_> decomp(m);
|
||||
// decomp.setThreshold(0);
|
||||
return static_cast<int>(decomp.rank());
|
||||
}
|
||||
|
||||
// m*a==b
|
||||
template<class DV, class DM, class V>
|
||||
static void solve(DV&a, DM const&m, V const& b){
|
||||
//a = m.colPivHouseholderQr().solve(b);
|
||||
a = m.fullPivLu().solve(b);
|
||||
}
|
||||
template<class DV, class DM, class V>
|
||||
static bool solve_and_check(DV&a, DM const&m, V const& b){
|
||||
//a = m.colPivHouseholderQr().solve(b);
|
||||
a = m.fullPivLu().solve(b);
|
||||
return b.isApprox(m*a);
|
||||
}
|
||||
// m*a==b
|
||||
template<class DV, class DM, class V>
|
||||
static void solve(DV&a, DM const&m, V const& b){
|
||||
//a = m.colPivHouseholderQr().solve(b);
|
||||
a = m.fullPivLu().solve(b);
|
||||
}
|
||||
template<class DV, class DM, class V>
|
||||
static bool solve_and_check(DV&a, DM const&m, V const& b){
|
||||
//a = m.colPivHouseholderQr().solve(b);
|
||||
a = m.fullPivLu().solve(b);
|
||||
return b.isApprox(m*a);
|
||||
}
|
||||
|
||||
static Dynamic_matrix basis(Dynamic_matrix const&m){
|
||||
return m.fullPivLu().image(m);
|
||||
}
|
||||
static Dynamic_matrix basis(Dynamic_matrix const&m){
|
||||
return m.fullPivLu().image(m);
|
||||
}
|
||||
|
||||
template<class Vec1,class Vec2> static Vector homogeneous_add(Vec1 const&a,Vec2 const&b){
|
||||
//TODO: use compile-time size when available
|
||||
int d=a.size();
|
||||
Vector 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<class Vec1,class Vec2> static Vector homogeneous_add(Vec1 const&a,Vec2 const&b){
|
||||
//TODO: use compile-time size when available
|
||||
int d=a.size();
|
||||
Vector 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<class Vec1,class Vec2> static Vector homogeneous_sub(Vec1 const&a,Vec2 const&b){
|
||||
int d=a.size();
|
||||
Vector 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<class Vec1,class Vec2> static Vector homogeneous_sub(Vec1 const&a,Vec2 const&b){
|
||||
int d=a.size();
|
||||
Vector 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<class Vec1,class Vec2> static std::pair<NT,NT> 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]);
|
||||
}
|
||||
template<class Vec1,class Vec2> static std::pair<NT,NT> 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]);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -199,19 +199,19 @@ struct Lazy_cartesian_types
|
|||
typedef typename typeset_intersection<
|
||||
typename AK_::Object_list,
|
||||
typename EK_::Object_list
|
||||
>::type Object_list;
|
||||
>::type Object_list;
|
||||
|
||||
typedef typename typeset_intersection<
|
||||
typename AK_::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> struct Type<T,Object_tag> {
|
||||
typedef Lazy<
|
||||
typename Get_type<AK_,T>::type,
|
||||
typename Get_type<EK_,T>::type,
|
||||
E2A_> type;
|
||||
typedef Lazy<
|
||||
typename Get_type<AK_,T>::type,
|
||||
typename Get_type<EK_,T>::type,
|
||||
E2A_> type;
|
||||
};
|
||||
template <class T> struct Type<T,Number_tag> {
|
||||
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.
|
||||
typedef typename internal::Lazy_construction_maybe_nt<
|
||||
Kernel_, AF, EF, is_NT_tag<Vt>::value
|
||||
>::type nth_elem;
|
||||
Kernel_, AF, EF, is_NT_tag<Vt>::value
|
||||
>::type nth_elem;
|
||||
|
||||
typedef Iterator_from_indices<
|
||||
const typename Type<typename iterator_tag_traits<T>::container>::type,
|
||||
const V, V, nth_elem
|
||||
const typename Type<typename iterator_tag_traits<T>::container>::type,
|
||||
const V, V, nth_elem
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
|
@ -288,39 +288,39 @@ struct Lazy_cartesian :
|
|||
// 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 {
|
||||
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> {
|
||||
typedef typename Get_functor<Approximate_kernel, T>::type FA;
|
||||
typedef typename Get_functor<Exact_kernel, T>::type FE;
|
||||
typedef Filtered_predicate2<Lazy_cartesian,FE,FA,C2E,C2A> type;
|
||||
typedef typename Get_functor<Approximate_kernel, T>::type FA;
|
||||
typedef typename Get_functor<Exact_kernel, T>::type FE;
|
||||
typedef Filtered_predicate2<Lazy_cartesian,FE,FA,C2E,C2A> type;
|
||||
};
|
||||
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> {
|
||||
typedef Lazy_construction2<T,Kernel> type;
|
||||
typedef Lazy_construction2<T,Kernel> type;
|
||||
};
|
||||
template<class D> struct Functor<Point_dimension_tag,D,Misc_tag> {
|
||||
typedef typename Get_functor<Approximate_kernel, Point_dimension_tag>::type FA;
|
||||
struct type {
|
||||
FA fa;
|
||||
type(){}
|
||||
type(Kernel const&k):fa(k.approximate_kernel()){}
|
||||
template<class P>
|
||||
int operator()(P const&p)const{return fa(CGAL::approx(p));}
|
||||
};
|
||||
typedef typename Get_functor<Approximate_kernel, Point_dimension_tag>::type FA;
|
||||
struct type {
|
||||
FA fa;
|
||||
type(){}
|
||||
type(Kernel const&k):fa(k.approximate_kernel()){}
|
||||
template<class P>
|
||||
int operator()(P const&p)const{return fa(CGAL::approx(p));}
|
||||
};
|
||||
};
|
||||
template<class D> struct Functor<Vector_dimension_tag,D,Misc_tag> {
|
||||
typedef typename Get_functor<Approximate_kernel, Vector_dimension_tag>::type FA;
|
||||
struct type {
|
||||
FA fa;
|
||||
type(){}
|
||||
type(Kernel const&k):fa(k.approximate_kernel()){}
|
||||
template<class V>
|
||||
int operator()(V const&v)const{return fa(CGAL::approx(v));}
|
||||
};
|
||||
typedef typename Get_functor<Approximate_kernel, Vector_dimension_tag>::type FA;
|
||||
struct type {
|
||||
FA fa;
|
||||
type(){}
|
||||
type(Kernel const&k):fa(k.approximate_kernel()){}
|
||||
template<class V>
|
||||
int operator()(V const&v)const{return fa(CGAL::approx(v));}
|
||||
};
|
||||
};
|
||||
template<class D> struct Functor<Linear_base_tag,D,Misc_tag> {
|
||||
// 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 Base::template Type<Vector_tag>::type V; // Lazy<AT, ET, E2A>
|
||||
struct type {
|
||||
FE fe;
|
||||
type(){}
|
||||
type(Kernel const&k):fe(k.exact_kernel()){}
|
||||
template<class Iter, class Oter>
|
||||
void operator()(Iter i, Iter e, Oter o)const{
|
||||
fe(CGAL::exact(i), CGAL::exact(e),
|
||||
boost::make_function_output_iterator(
|
||||
[&o](ET const&v){
|
||||
*o++ = V(new Lazy_rep_0<AT,ET,E2A>(v));
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
FE fe;
|
||||
type(){}
|
||||
type(Kernel const&k):fe(k.exact_kernel()){}
|
||||
template<class Iter, class Oter>
|
||||
void operator()(Iter i, Iter e, Oter o)const{
|
||||
fe(CGAL::exact(i), CGAL::exact(e),
|
||||
boost::make_function_output_iterator(
|
||||
[&o](ET const&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
|
||||
template<class U>
|
||||
struct Construct_iter : private Store_kernel<Kernel> {
|
||||
Construct_iter(){}
|
||||
Construct_iter(Kernel const&k):Store_kernel<Kernel>(k){}
|
||||
//FIXME: pass the kernel to the functor in the iterator
|
||||
typedef U result_type;
|
||||
template<class T>
|
||||
result_type operator()(T const& t,Begin_tag)const{
|
||||
return result_type(t,0,this->kernel());
|
||||
}
|
||||
template<class T>
|
||||
result_type operator()(T const& t,End_tag)const{
|
||||
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());
|
||||
}
|
||||
Construct_iter(){}
|
||||
Construct_iter(Kernel const&k):Store_kernel<Kernel>(k){}
|
||||
//FIXME: pass the kernel to the functor in the iterator
|
||||
typedef U result_type;
|
||||
template<class T>
|
||||
result_type operator()(T const& t,Begin_tag)const{
|
||||
return result_type(t,0,this->kernel());
|
||||
}
|
||||
template<class T>
|
||||
result_type operator()(T const& t,End_tag)const{
|
||||
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());
|
||||
}
|
||||
};
|
||||
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>
|
||||
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;
|
||||
inline result_type operator()(F&&f,T&&t,U&&...u)const{
|
||||
return Apply_to_last_then_rest_<d-1,F,U...,T>()(
|
||||
std::forward<F>(f),
|
||||
std::forward<U>(u)...,
|
||||
std::forward<T>(t));
|
||||
}
|
||||
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{
|
||||
return Apply_to_last_then_rest_<d-1,F,U...,T>()(
|
||||
std::forward<F>(f),
|
||||
std::forward<U>(u)...,
|
||||
std::forward<T>(t));
|
||||
}
|
||||
};
|
||||
|
||||
template<class F,class T,class... U>
|
||||
struct Apply_to_last_then_rest_<0,F,T,U...> {
|
||||
typedef decltype(std::declval<F>()(std::declval<T>(), std::declval<U>()...)) result_type;
|
||||
inline result_type operator()(F&&f,T&&t,U&&...u)const{
|
||||
return std::forward<F>(f)(std::forward<T>(t), std::forward<U>(u)...);
|
||||
}
|
||||
typedef decltype(std::declval<F>()(std::declval<T>(), std::declval<U>()...)) result_type;
|
||||
inline result_type operator()(F&&f,T&&t,U&&...u)const{
|
||||
return std::forward<F>(f)(std::forward<T>(t), std::forward<U>(u)...);
|
||||
}
|
||||
};
|
||||
} // namespace internal
|
||||
|
||||
struct Apply_to_last_then_rest {
|
||||
template<class F,class T,class...U> inline
|
||||
typename internal::Apply_to_last_then_rest_<sizeof...(U),F,T,U...>::result_type
|
||||
operator()(F&&f,T&&t,U&&...u)const{
|
||||
return internal::Apply_to_last_then_rest_<sizeof...(U),F,T,U...>()(
|
||||
std::forward<F>(f),
|
||||
std::forward<T>(t),
|
||||
std::forward<U>(u)...);
|
||||
}
|
||||
template<class F,class T,class...U> inline
|
||||
typename internal::Apply_to_last_then_rest_<sizeof...(U),F,T,U...>::result_type
|
||||
operator()(F&&f,T&&t,U&&...u)const{
|
||||
return internal::Apply_to_last_then_rest_<sizeof...(U),F,T,U...>()(
|
||||
std::forward<F>(f),
|
||||
std::forward<T>(t),
|
||||
std::forward<U>(u)...);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace CGAL {
|
|||
std::conditional<
|
||||
contains<X>::value,
|
||||
typeset<H,U...>,
|
||||
typeset<H,U...,X>
|
||||
typeset<H,U...,X>
|
||||
>::type;
|
||||
};
|
||||
template<> struct typeset<> {
|
||||
|
|
@ -58,8 +58,8 @@ namespace CGAL {
|
|||
typedef typename T1::head H;
|
||||
typedef typename typeset_intersection_<typename T1::tail,T2>::type U;
|
||||
typedef typename
|
||||
std::conditional<T2::template contains<H>::value,
|
||||
typename U::template add<H>::type, U>::type type;
|
||||
std::conditional<T2::template contains<H>::value,
|
||||
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_all, T> : T {};
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
// Copyright (c) 1999
|
||||
// Copyright (c) 1999
|
||||
// Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland),
|
||||
// INRIA Sophia-Antipolis (France),
|
||||
// Max-Planck-Institute Saarbruecken (Germany),
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
// and Tel-Aviv University (Israel). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org)
|
||||
//
|
||||
|
|
@ -131,7 +131,7 @@ inline bool possibly(Uncertain<bool> c);
|
|||
|
||||
# define CGAL_static_assertion(EX) \
|
||||
BOOST_STATIC_ASSERT(true) CGAL_UNUSED
|
||||
|
||||
|
||||
# define CGAL_static_assertion_msg(EX,MSG) \
|
||||
BOOST_STATIC_ASSERT(true) CGAL_UNUSED
|
||||
|
||||
|
|
@ -139,14 +139,14 @@ inline bool possibly(Uncertain<bool> c);
|
|||
|
||||
# define CGAL_static_assertion(EX) \
|
||||
BOOST_STATIC_ASSERT(EX) CGAL_UNUSED
|
||||
|
||||
|
||||
# define CGAL_static_assertion_msg(EX,MSG) \
|
||||
BOOST_STATIC_ASSERT(EX) CGAL_UNUSED
|
||||
|
||||
# endif // no CGAL_NO_ASSERTIONS
|
||||
|
||||
#endif // if CGAL_CFG_NO_CPP0X_STATIC_ASSERT is true
|
||||
|
||||
|
||||
#if defined(CGAL_NO_ASSERTIONS) || !defined(CGAL_CHECK_EXACTNESS)
|
||||
# define CGAL_exactness_assertion(EX) (static_cast<void>(0))
|
||||
# define CGAL_exactness_assertion_msg(EX,MSG) (static_cast<void>(0))
|
||||
|
|
@ -223,7 +223,7 @@ inline bool possibly(Uncertain<bool> c);
|
|||
# define CGAL_expensive_precondition_code(CODE) CODE
|
||||
#endif // CGAL_NO_PRECONDITIONS
|
||||
|
||||
#if defined(CGAL_NO_PRECONDITIONS) || !defined(CGAL_CHECK_EXACTNESS) || !defined(CGAL_CHECK_EXPENSIVE)
|
||||
#if defined(CGAL_NO_PRECONDITIONS) || !defined(CGAL_CHECK_EXACTNESS) || !defined(CGAL_CHECK_EXPENSIVE)
|
||||
# define CGAL_expensive_exactness_precondition(EX) (static_cast<void>(0))
|
||||
# define CGAL_expensive_exactness_precondition_msg(EX,MSG) (static_cast<void>(0))
|
||||
# define CGAL_expensive_exactness_precondition_code(CODE)
|
||||
|
|
|
|||
Loading…
Reference in New Issue