summaryrefslogtreecommitdiff
path: root/polyset.cc
diff options
context:
space:
mode:
authorclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2010-01-05 19:09:01 (GMT)
committerclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2010-01-05 19:09:01 (GMT)
commita02e00083f385a1770103569e07b2b5eb8d7ee4f (patch)
treeeb21fc21ba838912e99e732155ac7de3945624f2 /polyset.cc
parent8457c079e3d9d8aa77b184c1ba1dec09f7116fc6 (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.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/polyset.cc b/polyset.cc
index 135811b..56c90b9 100644
--- a/polyset.cc
+++ b/polyset.cc
@@ -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
{
contact: Jan Huwald // Impressum