summaryrefslogtreecommitdiff
path: root/src/export.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-12-26 15:37:00 (GMT)
committerMarius Kintel <marius@kintel.net>2011-12-26 15:37:00 (GMT)
commitcbabbaed700536b3a1f513fd5a07d25382cb137f (patch)
tree17478b52e8e8205709c6862b605caf6762445dfa /src/export.cc
parent312a25f2708fcef22e300f7bd2c1aaed61d3095d (diff)
parent4ff2d1af446c1f276c644b12e6ec4cc6db0b6d65 (diff)
Merge branch 'master' into boost_filesystem
Conflicts: openscad.pro src/module.h
Diffstat (limited to 'src/export.cc')
-rw-r--r--src/export.cc3
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 << " "
contact: Jan Huwald // Impressum