diff options
author | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-01-05 19:09:01 (GMT) |
---|---|---|
committer | clifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c> | 2010-01-05 19:09:01 (GMT) |
commit | a02e00083f385a1770103569e07b2b5eb8d7ee4f (patch) | |
tree | eb21fc21ba838912e99e732155ac7de3945624f2 /polyset.cc | |
parent | 8457c079e3d9d8aa77b184c1ba1dec09f7116fc6 (diff) |
Clifford Wolf:
New hack for 2d transformations:
create DxfData, transform, tess to polyset, recreate nef
git-svn-id: http://svn.clifford.at/openscad/trunk@203 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'polyset.cc')
-rw-r--r-- | polyset.cc | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -369,15 +369,25 @@ CGAL_Nef_polyhedron PolySet::render_cgal_nef_polyhedron() const { 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); + typedef std::list<CGAL_Nef_polyhedron2::Point> point_list_t; + typedef point_list_t::iterator point_list_it; + std::list< point_list_t > pdata_point_lists; + std::list < std::pair < point_list_it, point_list_it > > pdata; + + for (int i = 0; i < this->polygons.size(); i++) { + pdata_point_lists.push_back(point_list_t()); + for (int j = 0; j < this->polygons[i].size(); j++) { + double x = this->polygons[i][j].x; + double y = this->polygons[i][j].y; + CGAL_Nef_polyhedron2::Point p = CGAL_Nef_polyhedron2::Point(x, y); + pdata_point_lists.back().push_back(p); + } + pdata.push_back(std::make_pair(pdata_point_lists.back().begin(), + pdata_point_lists.back().end())); } + + CGAL_Nef_polyhedron2 N(pdata.begin(), pdata.end(), CGAL_Nef_polyhedron2::POLYGONS); + return CGAL_Nef_polyhedron(N); } else { |