Safeguard against division by zero

This commit is contained in:
Mael Rouxel-Labbé 2024-03-25 10:44:52 +01:00
parent 8677a81439
commit de9c1f3dc9
1 changed files with 3 additions and 0 deletions

View File

@ -99,6 +99,9 @@ public:
const FT n = CGAL::approximate_sqrt(CGAL::square(gx) + CGAL::square(gy) + CGAL::square(gz));
if(is_zero(n))
return vector(0,0,0);
return vector(gx / n, gy / n, gz / n);
}
};