summaryrefslogtreecommitdiff
path: root/src/cgaladv.cc
diff options
context:
space:
mode:
authorGiles Bathgate <gilesbathgate@gmail.com>2011-04-09 16:53:19 (GMT)
committerGiles Bathgate <gilesbathgate@gmail.com>2011-04-09 16:53:19 (GMT)
commit5d5c745fdecd2580b5254cc1fd758bdc31ff88ba (patch)
treed3a6214069a48371b4a58f6ab0cf4fa47e4f1a77 /src/cgaladv.cc
parent5ef540054cc4a548a78eb78318e527f0e283ece8 (diff)
Slight improvement. You no longer need an arbitary shape in the script for it to work.
See changes in testdata/scad/convex_hull.scad The square(2) was never rendered it was just there because the hull is calculated when it itterates onto the second child. I also removed the unneeded parameter.
Diffstat (limited to 'src/cgaladv.cc')
-rw-r--r--src/cgaladv.cc31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/cgaladv.cc b/src/cgaladv.cc
index 48f14c7..45a3bdd 100644
--- a/src/cgaladv.cc
+++ b/src/cgaladv.cc
@@ -34,7 +34,7 @@
#ifdef ENABLE_CGAL
extern CGAL_Nef_polyhedron3 minkowski3(CGAL_Nef_polyhedron3 a, CGAL_Nef_polyhedron3 b);
extern CGAL_Nef_polyhedron2 minkowski2(CGAL_Nef_polyhedron2 a, CGAL_Nef_polyhedron2 b);
-extern CGAL_Nef_polyhedron2 convexhull2(CGAL_Nef_polyhedron2 a, CGAL_Nef_polyhedron2 b);
+extern CGAL_Nef_polyhedron2 convexhull2(CGAL_Nef_polyhedron2 a);
#endif
enum cgaladv_type_e {
@@ -183,24 +183,19 @@ CGAL_Nef_polyhedron CgaladvNode::render_cgal_nef_polyhedron() const
if (type == HULL)
{
- bool first = true;
+
foreach(AbstractNode * v, children) {
- if (v->modinst->tag_background)
- continue;
- if (first) {
- N = v->render_cgal_nef_polyhedron();
- if (N.dim != 0)
- first = false;
- } else {
- CGAL_Nef_polyhedron tmp = v->render_cgal_nef_polyhedron();
- if (N.dim == 3 && tmp.dim == 3) {
-
- }
- if (N.dim == 2 && tmp.dim == 2) {
- N.p2 = convexhull2(N.p2, tmp.p2);
- }
- }
- v->progress_report();
+ if (v->modinst->tag_background)
+ continue;
+ N = v->render_cgal_nef_polyhedron();
+ if (N.dim == 3) {
+
+ }
+ if (N.dim == 2) {
+ N.p2 = convexhull2(N.p2);
+ }
+ v->progress_report();
+ break;
}
}
contact: Jan Huwald // Impressum