diff options
author | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-01-31 00:59:50 (GMT) |
---|---|---|
committer | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-01-31 00:59:50 (GMT) |
commit | 32c10fec341c6c349f0d4ebbd91f24517d5e3743 (patch) | |
tree | 912fb78d4e793735ddb508a7348d48b732eaf022 /src/projection.cc | |
parent | ea77e90a5463428a54cff9ab25c84c9c8687882e (diff) |
Clifford Wolf:
Fixed projection(cut=true) for degenerated triangles
git-svn-id: http://svn.clifford.at/openscad/trunk@384 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'src/projection.cc')
-rw-r--r-- | src/projection.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/projection.cc b/src/projection.cc index d2f417c..ba8c520 100644 --- a/src/projection.cc +++ b/src/projection.cc @@ -195,14 +195,24 @@ PolySet *ProjectionNode::render_polyset(render_mode_e rm) const // N.p3 *= CGAL_Nef_polyhedron3(CGAL_Plane(0, 0, 1, 0), CGAL_Nef_polyhedron3::INCLUDED); N.p3 *= Ncube.p3; cgal_nef3_to_polyset(ps3, &N); + Grid2d<int> conversion_grid(GRID_COARSE); for (int i = 0; i < ps3->polygons.size(); i++) { for (int j = 0; j < ps3->polygons[i].size(); j++) { - if (ps3->polygons[i][j].z != 0) + double x = ps3->polygons[i][j].x; + double y = ps3->polygons[i][j].y; + double z = ps3->polygons[i][j].z; + if (z != 0) + goto next_ps3_polygon_cut_mode; + if (conversion_grid.align(x, y) == i+1) goto next_ps3_polygon_cut_mode; + conversion_grid.data(x, y) = i+1; } ps->append_poly(); for (int j = 0; j < ps3->polygons[i].size(); j++) { - ps->insert_vertex(ps3->polygons[i][j].x, ps3->polygons[i][j].y); + double x = ps3->polygons[i][j].x; + double y = ps3->polygons[i][j].y; + conversion_grid.align(x, y); + ps->insert_vertex(x, y); } next_ps3_polygon_cut_mode:; } |