mirror of https://github.com/vitalif/openscad
Always normalize normal vector, for safety
parent
e1c62ea152
commit
cd8607d87d
|
@ -107,9 +107,9 @@ namespace CGALUtils {
|
|||
else {
|
||||
// Calculate best guess at face normal using Newell's method
|
||||
CGAL::normal_vector_newell_3(polygons.front().begin(), polygons.front().end(), normalvec);
|
||||
double sqrl = normalvec.squared_length();
|
||||
if (sqrl > 0.0) normalvec = normalvec / sqrt(sqrl);
|
||||
}
|
||||
double sqrl = normalvec.squared_length();
|
||||
if (sqrl > 0.0) normalvec = normalvec / sqrt(sqrl);
|
||||
|
||||
// Pass the normal vector to the (undocumented)
|
||||
// CGAL::Triangulation_2_filtered_projection_traits_3. This
|
||||
|
@ -164,9 +164,9 @@ namespace CGALUtils {
|
|||
else {
|
||||
// Calculate best guess at face normal using Newell's method
|
||||
CGAL::normal_vector_newell_3(polygon.begin(), polygon.end(), normalvec);
|
||||
double sqrl = normalvec.squared_length();
|
||||
if (sqrl > 0.0) normalvec = normalvec / sqrt(sqrl);
|
||||
}
|
||||
double sqrl = normalvec.squared_length();
|
||||
if (sqrl > 0.0) normalvec = normalvec / sqrt(sqrl);
|
||||
|
||||
// Pass the normal vector to the (undocumented)
|
||||
// CGAL::Triangulation_2_filtered_projection_traits_3. This
|
||||
|
|
Loading…
Reference in New Issue