Use std::clamp

This commit is contained in:
Mael Rouxel-Labbé 2024-12-10 17:09:54 +01:00
parent 2838ad24d9
commit 20115d3dcb
1 changed files with 1 additions and 9 deletions

View File

@ -972,15 +972,7 @@ namespace CommonKernelFunctors {
// cosine
double dot = to_double(scalar_product(u,v));
double cosine = dot / product;
if(cosine > 1.){
cosine = 1.;
}
if(cosine < -1.){
cosine = -1.;
}
double cosine = std::clamp(dot / product, -1., 1.);
return std::acos(cosine) * 180./CGAL_PI;
}