diff options
author | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-12-29 11:08:27 (GMT) |
---|---|---|
committer | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2009-12-29 11:08:27 (GMT) |
commit | 0d198de8ff3986b678e824824d0f3dd0933255d0 (patch) | |
tree | 6a68edafcda0bad1f2d12992604afb40fd22b08f /polyset.cc | |
parent | f7799a8e4ea0c31bd284dc4cf5e2d23b13029a4c (diff) |
Clifford Wolf:
Some progress with the 2d sub system
git-svn-id: http://svn.clifford.at/openscad/trunk@188 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'polyset.cc')
-rw-r--r-- | polyset.cc | 29 |
1 files changed, 23 insertions, 6 deletions
@@ -26,6 +26,7 @@ QCache<QString,PolySetPtr> PolySet::ps_cache(100); PolySet::PolySet() { + is2d = false; convexity = 1; refcount = 1; } @@ -284,14 +285,30 @@ public: CGAL_Nef_polyhedron PolySet::render_cgal_nef_polyhedron() const { - CGAL_Polyhedron P; - CGAL_Build_PolySet builder(this); - P.delegate(builder); + if (this->is2d) + { + int len = this->polygons[0].size(); + if (len > 0) { + CGAL_Nef_polyhedron2::Point points[len]; + for (int i = 0; i < len; i++) + points[i] = CGAL_Nef_polyhedron2::Point(this->polygons[0][i].x, + this->polygons[0][i].y); + CGAL_Nef_polyhedron2 N(points, points+len); + return CGAL_Nef_polyhedron(N); + } + } + else + { + CGAL_Polyhedron P; + CGAL_Build_PolySet builder(this); + P.delegate(builder); #if 0 - std::cout << P; + std::cout << P; #endif - CGAL_Nef_polyhedron3 N(P); - return CGAL_Nef_polyhedron(N); + CGAL_Nef_polyhedron3 N(P); + return CGAL_Nef_polyhedron(N); + } + return CGAL_Nef_polyhedron(); } #endif /* ENABLE_CGAL */ |