summaryrefslogtreecommitdiff
path: root/src/cgaladv.cc
diff options
context:
space:
mode:
authorclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2010-03-03 19:27:22 (GMT)
committerclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2010-03-03 19:27:22 (GMT)
commit1cbb05babf513b14855c05e046478e4d156bd665 (patch)
treee525edbe1fb50a38c4a778d1b4a7d5fd10a9d47e /src/cgaladv.cc
parent3dbb23ce682cbe1f8da83de2c12ecd362f76eef6 (diff)
Clifford Wolf:
Little progress with 2d minkowski code git-svn-id: http://svn.clifford.at/openscad/trunk@480 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'src/cgaladv.cc')
-rw-r--r--src/cgaladv.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/cgaladv.cc b/src/cgaladv.cc
index 6a89910..829bc84 100644
--- a/src/cgaladv.cc
+++ b/src/cgaladv.cc
@@ -31,7 +31,8 @@
#include "cgal.h"
#ifdef ENABLE_CGAL
-#include <CGAL/minkowski_sum_3.h>
+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);
#endif
enum cgaladv_type_e {
@@ -142,26 +143,24 @@ CGAL_Nef_polyhedron CgaladvNode::render_cgal_nef_polyhedron() const
if (type == MINKOWSKI)
{
bool first = true;
- CGAL_Nef_polyhedron a, b;
foreach(AbstractNode * v, children) {
if (v->modinst->tag_background)
continue;
if (first) {
- a = v->render_cgal_nef_polyhedron();
- if (a.dim != 0)
+ N = v->render_cgal_nef_polyhedron();
+ if (N.dim != 0)
first = false;
} else {
- b += v->render_cgal_nef_polyhedron();
+ CGAL_Nef_polyhedron tmp = v->render_cgal_nef_polyhedron();
+ if (N.dim == 3 && tmp.dim == 3) {
+ N.p3 = minkowski3(N.p3, tmp.p3);
+ }
+ if (N.dim == 2 && tmp.dim == 2) {
+ N.p2 = minkowski2(N.p2, tmp.p2);
+ }
}
v->progress_report();
}
- if (a.dim == 3 && b.dim == 3) {
- N.dim = 3;
- N.p3 = CGAL::minkowski_sum_3(a.p3, b.p3);
- }
- if (a.dim == 2 && b.dim == 2) {
- PRINT("WARNING: minkowski() is not implemented yet for 2d objects!");
- }
}
if (type == GLIDE)
contact: Jan Huwald // Impressum