diff options
author | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-07-22 10:11:18 (GMT) |
---|---|---|
committer | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-07-22 10:11:18 (GMT) |
commit | 7236439c5a98db89b8b8e2732466649d15b16b41 (patch) | |
tree | f1bec55949e71eb200de2eb7dc94523ed3fe2834 | |
parent | bb15d75642157364bd6a9a65b224f37b93d0b2f0 (diff) |
Clifford Wolf:
Skip degenerated facets in polyset
(they may be produces during dxf tesselation)
git-svn-id: http://svn.clifford.at/openscad/trunk@67 b57f626f-c46c-0410-a088-ec61d464b74c
-rw-r--r-- | polyset.cc | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -225,7 +225,17 @@ public: for (int i = 0; i < ps->polygons.size(); i++) { const PolySet::Polygon *poly = &ps->polygons[i]; - B.begin_facet(); + QHash<int,int> fc; + bool facet_is_degenerated = false; + for (int j = 0; j < poly->size(); j++) { + const PolySet::Point *p = &poly->at(j); + int v = vertices_idx.data(p->x, p->y, p->z); + if (fc[v]++ > 0) + facet_is_degenerated = true; + } + + if (!facet_is_degenerated) + B.begin_facet(); #ifdef GEN_SURFACE_DEBUG printf("F:"); #endif @@ -234,12 +244,16 @@ public: #ifdef GEN_SURFACE_DEBUG printf(" %d", vertices_idx.data(p->x, p->y, p->z)); #endif - B.add_vertex_to_facet(vertices_idx.data(p->x, p->y, p->z)); + if (!facet_is_degenerated) + B.add_vertex_to_facet(vertices_idx.data(p->x, p->y, p->z)); } #ifdef GEN_SURFACE_DEBUG + if (facet_is_degenerated) + printf(" (degenerated)\n"); printf("\n"); #endif - B.end_facet(); + if (!facet_is_degenerated) + B.end_facet(); } #ifdef GEN_SURFACE_DEBUG |