diff options
author | Marius Kintel <marius@kintel.net> | 2011-12-26 12:22:43 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-12-26 12:22:43 (GMT) |
commit | f0817a1c167c9d9f0ecf0ef8ec7bee03d61e63f2 (patch) | |
tree | 2fa517953072d13d27e8c042021997e3db8b90be /src | |
parent | 85420b81b3e0ef7e8c17ad4911eb8a3316a9156e (diff) |
bugfix: Reinstated normal length sanity check since at least once case slipped through; testdata/scad/misc/normal-nan.scad
Diffstat (limited to 'src')
-rw-r--r-- | src/export.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/export.cc b/src/export.cc index 99bce98..5ce2d15 100644 --- a/src/export.cc +++ b/src/export.cc @@ -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 nz = dn[0]*dn[4] - dn[1]*dn[3]; 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 " << nx / nlength << " " << ny / nlength << " " |