From 6a13c83fe1cbaaa6ed86cb9e1597c80b752e5dde Mon Sep 17 00:00:00 2001 From: clifford Date: Thu, 28 Jan 2010 10:57:02 +0000 Subject: [PATCH] Clifford Wolf: More 2d polyset->nef experiments git-svn-id: http://svn.clifford.at/openscad/trunk@358 b57f626f-c46c-0410-a088-ec61d464b74c --- polyset.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/polyset.cc b/polyset.cc index 8c2dc866..84c7d1de 100644 --- a/polyset.cc +++ b/polyset.cc @@ -460,8 +460,7 @@ CGAL_Nef_polyhedron PolySet::render_cgal_nef_polyhedron() const #if 0 // This version of the code does essentially the same thing as the 2nd // version but merges some triangles before sending them to CGAL. This adds - // complexity. There was hope that this would speed up things. Unfortunately - // it does not look like it does.. + // complexity but might speed up things.. // // !! STILL WORK IN PROGRESS !! // @@ -558,8 +557,8 @@ CGAL_Nef_polyhedron PolySet::render_cgal_nef_polyhedron() const if (poly3_n < 0) continue; if (poly3_n == poly1_n) { - this->egde_to_poly[QPair(c, d)].first = 0; - this->egde_to_poly[QPair(c, d)].second = 0; + // this->egde_to_poly[QPair(c, d)].first = 0; + // this->egde_to_poly[QPair(c, d)].second = 0; goto next_poly1_edge; } } @@ -578,12 +577,12 @@ CGAL_Nef_polyhedron PolySet::render_cgal_nef_polyhedron() const } printf(" |"); int start_poly2_2nd_seg = poly2_entry_n == this->polygons[poly2_n].size() ? 1 : 0; - for (int k = poly2_entry_n-2; k >= start_poly2_2nd_seg; k--) { + for (int k = start_poly2_2nd_seg; k < poly2_entry_n-1; k++) { printf(" %d", this->polygons[poly2_n][k]); this->polygons[this->poly_n].append(this->polygons[poly2_n][k]); } printf(" |"); - for (int k = this->polygons[poly2_n].size()-1; k > poly2_entry_n; k--) { + for (int k = poly2_entry_n+1; k < this->polygons[poly2_n].size(); k++) { printf(" %d", this->polygons[poly2_n][k]); this->polygons[this->poly_n].append(this->polygons[poly2_n][k]); } @@ -597,8 +596,12 @@ CGAL_Nef_polyhedron PolySet::render_cgal_nef_polyhedron() const del_poly(poly2_n); add_edges(this->poly_n); work_queue.append(this->poly_n); - this->poly_n++; printf("New number of polygons: %d\n", this->polygons.size()); + for (int k = 0; k < this->polygons[this->poly_n].size(); k++) { + int p = this->polygons[this->poly_n][k]; + printf("%d %f %f\n", p, to_double(points[p].x()), to_double(points[p].y())); + } + this->poly_n++; goto next_poly1; } next_poly1_edge:; @@ -615,9 +618,11 @@ CGAL_Nef_polyhedron PolySet::render_cgal_nef_polyhedron() const while (it.hasNext()) { it.next(); std::list plist; + printf("===\n"); for (int j = 0; j < it.value().size(); j++) { int p = it.value()[j]; plist.push_back(points[p]); + printf("%d %f %f\n", p, to_double(points[p].x()), to_double(points[p].y())); } N += CGAL_Nef_polyhedron2(plist.begin(), plist.end(), CGAL_Nef_polyhedron2::INCLUDED); }