mirror of https://github.com/CGAL/cgal
add a function that convert to double and do the normalization
This commit is contained in:
parent
881fdab58d
commit
7c6450192e
|
|
@ -71,6 +71,23 @@ VVector convert(const CGAL::Vector_3<R>& v)
|
|||
CGAL::to_double(v.y()),
|
||||
CGAL::to_double(v.z())); }
|
||||
|
||||
template <typename R>
|
||||
VVector normalize_and_convert(const CGAL::Vector_3<R>& v)
|
||||
{
|
||||
typename R::FT xa = CGAL::abs(v.x());
|
||||
typename R::FT ya = CGAL::abs(v.y());
|
||||
typename R::FT za = CGAL::abs(v.z());
|
||||
typename R::FT m = (std::max)((std::max)(xa,ya),za);
|
||||
if (m==0) {
|
||||
return VVector(0,0,0);
|
||||
} else {
|
||||
double xd = CGAL::to_double(v.x()/m);
|
||||
double yd = CGAL::to_double(v.y()/m);
|
||||
double zd = CGAL::to_double(v.z()/m);
|
||||
VVector u(xd,yd,zd);
|
||||
return u / CGAL_NTS sqrt(u*u) ; // normalize
|
||||
}
|
||||
}
|
||||
|
||||
const double refinement_angle = 0.1;
|
||||
const double shrink_fac = 0.995;
|
||||
|
|
|
|||
Loading…
Reference in New Issue