diff options
author | Marius Kintel <marius@kintel.net> | 2013-01-08 18:26:25 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-01-08 18:26:25 (GMT) |
commit | 810f1a86189555023240507848ff9eebb161b8de (patch) | |
tree | 287007ba314d94a551d2ef721dfc796598fede6c /src/CGALRenderer.cc | |
parent | 8cea6834f68cbbfb85c2568d388bf3b2e707cca5 (diff) |
Don't just ignore geometric nodes having zero volume/area - when doing difference/intersection, they tend to turn negative objects into positive ones. Fixes #221
Diffstat (limited to 'src/CGALRenderer.cc')
-rw-r--r-- | src/CGALRenderer.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/CGALRenderer.cc b/src/CGALRenderer.cc index adf1217..4357e44 100644 --- a/src/CGALRenderer.cc +++ b/src/CGALRenderer.cc @@ -43,7 +43,11 @@ CGALRenderer::CGALRenderer(const CGAL_Nef_polyhedron &root) : root(root) { - if (root.dim == 2) { + if (this->root.isNull()) { + this->polyhedron = NULL; + this->polyset = NULL; + } + else if (root.dim == 2) { DxfData *dd = root.convertToDxfData(); this->polyhedron = NULL; this->polyset = new PolySet(); @@ -67,10 +71,6 @@ CGALRenderer::CGALRenderer(const CGAL_Nef_polyhedron &root) : root(root) CGAL::OGL::Nef3_Converter<CGAL_Nef_polyhedron3>::convert_to_OGLPolyhedron(*this->root.p3, this->polyhedron); this->polyhedron->init(); } - else { - this->polyhedron = NULL; - this->polyset = NULL; - } } CGALRenderer::~CGALRenderer() @@ -81,6 +81,7 @@ CGALRenderer::~CGALRenderer() void CGALRenderer::draw(bool showfaces, bool showedges) const { + if (this->root.isNull()) return; if (this->root.dim == 2) { // Draw 2D polygons glDisable(GL_LIGHTING); |