mirror of https://github.com/vitalif/openscad
bugfix: Reinstated normal length sanity check since at least once case slipped through; testdata/scad/misc/normal-nan.scad
parent
85420b81b3
commit
f0817a1c16
|
@ -102,6 +102,9 @@ void export_stl(CGAL_Nef_polyhedron *root_N, std::ostream &output, QProgressDial
|
||||||
double ny = dn[2]*dn[3] - dn[0]*dn[5];
|
double ny = dn[2]*dn[3] - dn[0]*dn[5];
|
||||||
double nz = dn[0]*dn[4] - dn[1]*dn[3];
|
double nz = dn[0]*dn[4] - dn[1]*dn[3];
|
||||||
double nlength = sqrt(nx*nx + ny*ny + nz*nz);
|
double nlength = sqrt(nx*nx + ny*ny + nz*nz);
|
||||||
|
// Avoid generating normals for polygons with zero area
|
||||||
|
double eps = 0.000001;
|
||||||
|
if (nlength < eps) nlength = 1.0;
|
||||||
output << " facet normal "
|
output << " facet normal "
|
||||||
<< nx / nlength << " "
|
<< nx / nlength << " "
|
||||||
<< ny / nlength << " "
|
<< ny / nlength << " "
|
||||||
|
|
Loading…
Reference in New Issue