mirror of https://github.com/CGAL/cgal
Merge pull request #3794 from maxGimeno/Demo-Fix_off_reading-GF
PMP: Fix in normalize()
This commit is contained in:
commit
14e93b7fe2
|
|
@ -49,8 +49,13 @@ namespace internal {
|
||||||
{
|
{
|
||||||
typename GT::FT norm = CGAL::approximate_sqrt(
|
typename GT::FT norm = CGAL::approximate_sqrt(
|
||||||
traits.compute_squared_length_3_object()(v));
|
traits.compute_squared_length_3_object()(v));
|
||||||
|
//If the vector is small enough, approx_sqrt might return 0, and then we get nan values.
|
||||||
|
//To avoid that, we check the resulted norm. If it is 0, we don't normalize.
|
||||||
|
if(norm != 0)
|
||||||
|
{
|
||||||
v = traits.construct_divided_vector_3_object()(v, norm );
|
v = traits.construct_divided_vector_3_object()(v, norm );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<typename Point
|
template<typename Point
|
||||||
, typename GT>
|
, typename GT>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue