summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-01-29 18:17:58 (GMT)
committerkintel <kintel@b57f626f-c46c-0410-a088-ec61d464b74c>2010-01-29 18:17:58 (GMT)
commit2b19f33ee1ddce246c2bfe0a05fe379d0117a741 (patch)
tree7d395bab750064662280ea8f9c0e173dc0887ae1
parent6515b74004880e26824d50ac04d035248a731a6d (diff)
experimental code
git-svn-id: http://svn.clifford.at/openscad/trunk@363 b57f626f-c46c-0410-a088-ec61d464b74c
-rw-r--r--polyset.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/polyset.cc b/polyset.cc
index 740abda..5f22fde 100644
--- a/polyset.cc
+++ b/polyset.cc
@@ -607,6 +607,37 @@ CGAL_Nef_polyhedron PolySet::render_cgal_nef_polyhedron() const
// printf("Number of polygons after reduction: %d\n", pr.polygons.size());
return CGAL_Nef_polyhedron(pr.toNef());
#endif
+#if 0
+ // This is another experimental version. I should run faster than the above,
+ // is a lot simpler and has only one known weakness: Degenerate polygons, which
+ // get repaired by GLUTess, might trigger a CGAL crash here. The only
+ // known case for this is triangle-with-duplicate-vertex.dxf
+ if (this->polygons.size() > 0) assert(this->borders.size() > 0);
+ CGAL_Nef_polyhedron2 N;
+ Grid2d<CGAL_Nef_polyhedron2::Point> grid(GRID_COARSE);
+
+ for (int i = 0; i < this->borders.size(); i++) {
+ std::list<CGAL_Nef_polyhedron2::Point> plist;
+ for (int j = 0; j < this->borders[i].size(); j++) {
+ double x = this->borders[i][j].x;
+ double y = this->borders[i][j].y;
+ CGAL_Nef_polyhedron2::Point p;
+ if (grid.has(x, y)) {
+ p = grid.data(x, y);
+ } else {
+ p = CGAL_Nef_polyhedron2::Point(x, y);
+ grid.data(x, y) = p;
+ }
+ plist.push_back(p);
+ }
+ // FIXME: If a border (path) has a duplicate vertex in dxf,
+ // the CGAL_Nef_polyhedron2 constructor will crash.
+ N ^= CGAL_Nef_polyhedron2(plist.begin(), plist.end(), CGAL_Nef_polyhedron2::INCLUDED);
+ }
+
+ return CGAL_Nef_polyhedron(N);
+
+#endif
}
else
{
contact: Jan Huwald // Impressum