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,7 +49,12 @@ namespace internal {
|
|||
{
|
||||
typename GT::FT norm = CGAL::approximate_sqrt(
|
||||
traits.compute_squared_length_3_object()(v));
|
||||
v = traits.construct_divided_vector_3_object()(v, norm);
|
||||
//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 );
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Point
|
||||
|
|
|
|||
Loading…
Reference in New Issue