mirror of https://github.com/CGAL/cgal
Simplify the code
This commit is contained in:
parent
9a7c91c460
commit
0e75cea23c
|
|
@ -841,11 +841,8 @@ namespace CommonKernelFunctors {
|
||||||
{
|
{
|
||||||
K k;
|
K k;
|
||||||
typename K::Construct_vector_3 vector = k.construct_vector_3_object();
|
typename K::Construct_vector_3 vector = k.construct_vector_3_object();
|
||||||
typename K::Construct_cross_product_vector_3 cross_product =
|
|
||||||
k.construct_cross_product_vector_3_object();
|
|
||||||
typename K::Compute_scalar_product_3 scalar_product =
|
typename K::Compute_scalar_product_3 scalar_product =
|
||||||
k.compute_scalar_product_3_object();
|
k.compute_scalar_product_3_object();
|
||||||
typedef typename K::FT FT;
|
|
||||||
typedef typename K::Vector_3 Vector_3;
|
typedef typename K::Vector_3 Vector_3;
|
||||||
|
|
||||||
Vector_3 u = vector(q,p);
|
Vector_3 u = vector(q,p);
|
||||||
|
|
@ -860,24 +857,14 @@ namespace CommonKernelFunctors {
|
||||||
double dot = to_double(scalar_product(u,v));
|
double dot = to_double(scalar_product(u,v));
|
||||||
double cosine = dot / product;
|
double cosine = dot / product;
|
||||||
|
|
||||||
// sine
|
if(cosine > 1.){
|
||||||
Vector_3 w = cross_product(u, v);
|
cosine = 1.;
|
||||||
double abs_sine = CGAL::sqrt(to_double(scalar_product(w, w) / product));
|
|
||||||
|
|
||||||
if(abs_sine > 1.){
|
|
||||||
abs_sine = 1.;
|
|
||||||
}
|
}
|
||||||
if(abs_sine < -1.){
|
if(cosine < -1.){
|
||||||
abs_sine = -1.;
|
cosine = -1.;
|
||||||
}
|
}
|
||||||
|
|
||||||
double angle = std::asin(abs_sine);
|
return std::acos(cosine) * 180./CGAL_PI;
|
||||||
if(cosine < FT(0)){
|
|
||||||
angle = CGAL_PI - angle;
|
|
||||||
}
|
|
||||||
return angle * 180./CGAL_PI;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue