Merge pull request #3794 from maxGimeno/Demo-Fix_off_reading-GF

PMP: Fix in normalize()
This commit is contained in:
Laurent Rineau 2019-03-26 17:01:53 +01:00
commit 14e93b7fe2
1 changed files with 6 additions and 1 deletions

View File

@ -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