mirror of https://github.com/CGAL/cgal
move determinants to their own file
This commit is contained in:
parent
26e611e450
commit
784156ba77
|
|
@ -2,8 +2,7 @@
|
||||||
#define CGAL_VECTOR_DETVEC_SMALL_H
|
#define CGAL_VECTOR_DETVEC_SMALL_H
|
||||||
#include <CGAL/functor_tags.h>
|
#include <CGAL/functor_tags.h>
|
||||||
#include <CGAL/Dimension.h>
|
#include <CGAL/Dimension.h>
|
||||||
#include <CGAL/determinant.h>
|
#include <CGAL/determinant_of_vectors.h>
|
||||||
#include <CGAL/predicates/sign_of_determinant.h>
|
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
|
|
@ -29,13 +28,12 @@ struct Add_determinant_of_vectors_small_dim
|
||||||
template<class D> struct Property<Has_determinant_of_vectors_tag, D> :
|
template<class D> struct Property<Has_determinant_of_vectors_tag, D> :
|
||||||
boost::true_type {};
|
boost::true_type {};
|
||||||
|
|
||||||
template <class V1, class V2>
|
static NT determinant_of_vectors(Vector const&a, Vector const&b){
|
||||||
static NT determinant_of_vectors(V1 const&a, V2 const&b){
|
return CGAL::determinant_of_vectors<NT>(a,b);
|
||||||
return determinant(a[0],a[1],b[0],b[1]);
|
|
||||||
}
|
}
|
||||||
template <class V1, class V2>
|
template <class V1, class V2>
|
||||||
static Sign sign_of_determinant_of_vectors(V1 const&a, V2 const&b){
|
static Sign sign_of_determinant_of_vectors(V1 const&a, V2 const&b){
|
||||||
return sign_of_determinant(a[0],a[1],b[0],b[1]);
|
return CGAL::sign_of_determinant_of_vectors<NT>(a,b);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -53,11 +51,11 @@ struct Add_determinant_of_vectors_small_dim
|
||||||
|
|
||||||
static NT determinant_of_vectors(Vector const&a, Vector const&b,
|
static NT determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
Vector const&c){
|
Vector const&c){
|
||||||
return determinant(a[0],a[1],a[2],b[0],b[1],b[2],c[0],c[1],c[2]);
|
return CGAL::determinant_of_vectors<NT>(a,b,c);
|
||||||
}
|
}
|
||||||
static Sign sign_of_determinant_of_vectors(Vector const&a, Vector const&b,
|
static Sign sign_of_determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
Vector const&c){
|
Vector const&c){
|
||||||
return sign_of_determinant(a[0],a[1],a[2],b[0],b[1],b[2],c[0],c[1],c[2]);
|
return CGAL::sign_of_determinant_of_vectors<NT>(a,b,c);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -75,19 +73,55 @@ struct Add_determinant_of_vectors_small_dim
|
||||||
|
|
||||||
static NT determinant_of_vectors(Vector const&a, Vector const&b,
|
static NT determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
Vector const&c, Vector const&d){
|
Vector const&c, Vector const&d){
|
||||||
return determinant(
|
return CGAL::determinant_of_vectors<NT>(a,b,c,d);
|
||||||
a[0],a[1],a[2],a[3],
|
|
||||||
b[0],b[1],b[2],b[3],
|
|
||||||
c[0],c[1],c[2],c[3],
|
|
||||||
d[0],d[1],d[2],d[3]);
|
|
||||||
}
|
}
|
||||||
static Sign sign_of_determinant_of_vectors(Vector const&a, Vector const&b,
|
static Sign sign_of_determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
Vector const&c, Vector const&d){
|
Vector const&c, Vector const&d){
|
||||||
return sign_of_determinant(
|
return CGAL::sign_of_determinant_of_vectors<NT>(a,b,c,d);
|
||||||
a[0],a[1],a[2],a[3],
|
}
|
||||||
b[0],b[1],b[2],b[3],
|
};
|
||||||
c[0],c[1],c[2],c[3],
|
|
||||||
d[0],d[1],d[2],d[3]);
|
template <class LA, class Max_dim_>
|
||||||
|
struct Add_determinant_of_vectors_small_dim
|
||||||
|
<LA, Dimension_tag<5>, Max_dim_, false> : LA {
|
||||||
|
template< class D2, class D3=D2 >
|
||||||
|
struct Rebind_dimension {
|
||||||
|
typedef typename LA::template Rebind_dimension<D2,D3> LA2;
|
||||||
|
typedef Add_determinant_of_vectors_small_dim<LA2> Other;
|
||||||
|
};
|
||||||
|
template<class P,class=void> struct Property : LA::template Property<P> {};
|
||||||
|
template<class D> struct Property<Has_determinant_of_vectors_tag, D> :
|
||||||
|
boost::true_type {};
|
||||||
|
|
||||||
|
static NT determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
|
Vector const&c, Vector const&d, Vector const&e){
|
||||||
|
return CGAL::determinant_of_vectors<NT>(a,b,c,d,e);
|
||||||
|
}
|
||||||
|
static Sign sign_of_determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
|
Vector const&c, Vector const&d, Vector const&e){
|
||||||
|
return CGAL::sign_of_determinant_of_vectors<NT>(a,b,c,d,e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class LA, class Max_dim_>
|
||||||
|
struct Add_determinant_of_vectors_small_dim
|
||||||
|
<LA, Dimension_tag<6>, Max_dim_, false> : LA {
|
||||||
|
template< class D2, class D3=D2 >
|
||||||
|
struct Rebind_dimension {
|
||||||
|
typedef typename LA::template Rebind_dimension<D2,D3> LA2;
|
||||||
|
typedef Add_determinant_of_vectors_small_dim<LA2> Other;
|
||||||
|
};
|
||||||
|
template<class P,class=void> struct Property : LA::template Property<P> {};
|
||||||
|
template<class D> struct Property<Has_determinant_of_vectors_tag, D> :
|
||||||
|
boost::true_type {};
|
||||||
|
|
||||||
|
static NT determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
|
Vector const&c, Vector const&d, Vector const&e, Vector const&f){
|
||||||
|
return CGAL::determinant_of_vectors<NT>(a,b,c,d,e,f);
|
||||||
|
}
|
||||||
|
static Sign sign_of_determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
|
Vector const&c, Vector const&d, Vector const&e, Vector const&f){
|
||||||
|
return CGAL::sign_of_determinant_of_vectors<NT>(a,b,c,d,e,f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
#ifndef CGAL_DETVEC_H
|
||||||
|
#define CGAL_DETVEC_H
|
||||||
|
#include <CGAL/determinant.h>
|
||||||
|
#include <CGAL/predicates/sign_of_determinant.h>
|
||||||
|
|
||||||
|
namespace CGAL {
|
||||||
|
// TODO: determine whether it is better to pass them by lines or columns.
|
||||||
|
|
||||||
|
template <class NT, class Vector> inline
|
||||||
|
NT determinant_of_vectors(Vector const&a, Vector const&b){
|
||||||
|
return determinant<NT>(a[0],a[1],b[0],b[1]);
|
||||||
|
}
|
||||||
|
template <class NT, class Vector> inline
|
||||||
|
typename Sgn<NT>::result_type
|
||||||
|
sign_of_determinant_of_vectors(Vector const&a, Vector const&b){
|
||||||
|
return sign_of_determinant(a[0],a[1],b[0],b[1]);
|
||||||
|
|
||||||
|
template <class NT, class Vector>
|
||||||
|
NT determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
|
Vector const&c){
|
||||||
|
return determinant<NT>(a[0],a[1],a[2],b[0],b[1],b[2],c[0],c[1],c[2]);
|
||||||
|
}
|
||||||
|
template <class NT, class Vector>
|
||||||
|
typename Sgn<NT>::result_type
|
||||||
|
sign_of_determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
|
Vector const&c){
|
||||||
|
return sign_of_determinant(a[0],a[1],a[2],b[0],b[1],b[2],c[0],c[1],c[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class NT, class Vector>
|
||||||
|
NT determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
|
Vector const&c, Vector const&d){
|
||||||
|
return determinant<NT>(
|
||||||
|
a[0],a[1],a[2],a[3],
|
||||||
|
b[0],b[1],b[2],b[3],
|
||||||
|
c[0],c[1],c[2],c[3],
|
||||||
|
d[0],d[1],d[2],d[3]);
|
||||||
|
}
|
||||||
|
template <class NT, class Vector>
|
||||||
|
typename Sgn<NT>::result_type
|
||||||
|
sign_of_determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
|
Vector const&c, Vector const&d){
|
||||||
|
return sign_of_determinant(
|
||||||
|
a[0],a[1],a[2],a[3],
|
||||||
|
b[0],b[1],b[2],b[3],
|
||||||
|
c[0],c[1],c[2],c[3],
|
||||||
|
d[0],d[1],d[2],d[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class NT, class Vector>
|
||||||
|
NT determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
|
Vector const&c, Vector const&d, Vector const&e){
|
||||||
|
return determinant<NT>(
|
||||||
|
a[0],a[1],a[2],a[3],a[4],
|
||||||
|
b[0],b[1],b[2],b[3],b[4],
|
||||||
|
c[0],c[1],c[2],c[3],c[4],
|
||||||
|
d[0],d[1],d[2],d[3],d[4],
|
||||||
|
e[0],e[1],e[2],e[3],e[4]);
|
||||||
|
}
|
||||||
|
template <class NT, class Vector>
|
||||||
|
typename Sgn<NT>::result_type
|
||||||
|
sign_of_determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
|
Vector const&c, Vector const&d, Vector const&e){
|
||||||
|
return sign_of_determinant(
|
||||||
|
a[0],a[1],a[2],a[3],a[4],
|
||||||
|
b[0],b[1],b[2],b[3],b[4],
|
||||||
|
c[0],c[1],c[2],c[3],c[4],
|
||||||
|
d[0],d[1],d[2],d[3],d[4],
|
||||||
|
e[0],e[1],e[2],e[3],e[4]);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class NT, class Vector>
|
||||||
|
NT determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
|
Vector const&c, Vector const&d, Vector const&e, Vector const&f){
|
||||||
|
return determinant<NT>(
|
||||||
|
a[0],a[1],a[2],a[3],a[4],a[5],
|
||||||
|
b[0],b[1],b[2],b[3],b[4],b[5],
|
||||||
|
c[0],c[1],c[2],c[3],c[4],c[5],
|
||||||
|
d[0],d[1],d[2],d[3],d[4],d[5],
|
||||||
|
e[0],e[1],e[2],e[3],e[4],e[5],
|
||||||
|
f[0],f[1],f[2],f[3],f[4],f[5]);
|
||||||
|
}
|
||||||
|
template <class NT, class Vector>
|
||||||
|
typename Sgn<NT>::result_type
|
||||||
|
sign_of_determinant_of_vectors(Vector const&a, Vector const&b,
|
||||||
|
Vector const&c, Vector const&d, Vector const&e, Vector const&f){
|
||||||
|
return sign_of_determinant(
|
||||||
|
a[0],a[1],a[2],a[3],a[4],a[5],
|
||||||
|
b[0],b[1],b[2],b[3],b[4],b[5],
|
||||||
|
c[0],c[1],c[2],c[3],c[4],c[5],
|
||||||
|
d[0],d[1],d[2],d[3],d[4],d[5],
|
||||||
|
e[0],e[1],e[2],e[3],e[4],e[5],
|
||||||
|
f[0],f[1],f[2],f[3],f[4],f[5]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
@ -152,6 +152,7 @@ namespace CGAL {
|
||||||
struct Has_determinant_of_points_tag {};
|
struct Has_determinant_of_points_tag {};
|
||||||
struct Has_determinant_of_iterator_to_vectors_tag {};
|
struct Has_determinant_of_iterator_to_vectors_tag {};
|
||||||
struct Has_determinant_of_iterator_to_points_tag {};
|
struct Has_determinant_of_iterator_to_points_tag {};
|
||||||
|
struct Has_determinant_of_vectors_omit_last_tag {};
|
||||||
|
|
||||||
// Kernel properties
|
// Kernel properties
|
||||||
struct Point_stores_squared_distance_to_origin_tag {};
|
struct Point_stores_squared_distance_to_origin_tag {};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue