summaryrefslogtreecommitdiff
path: root/mainwin.cc
diff options
context:
space:
mode:
authorclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-12-29 11:08:27 (GMT)
committerclifford <clifford@b57f626f-c46c-0410-a088-ec61d464b74c>2009-12-29 11:08:27 (GMT)
commit0d198de8ff3986b678e824824d0f3dd0933255d0 (patch)
tree6a68edafcda0bad1f2d12992604afb40fd22b08f /mainwin.cc
parentf7799a8e4ea0c31bd284dc4cf5e2d23b13029a4c (diff)
Clifford Wolf:
Some progress with the 2d sub system git-svn-id: http://svn.clifford.at/openscad/trunk@188 b57f626f-c46c-0410-a088-ec61d464b74c
Diffstat (limited to 'mainwin.cc')
-rw-r--r--mainwin.cc38
1 files changed, 36 insertions, 2 deletions
diff --git a/mainwin.cc b/mainwin.cc
index 4fe8724..836901f 100644
--- a/mainwin.cc
+++ b/mainwin.cc
@@ -910,7 +910,9 @@ void MainWindow::actionRenderCGAL()
QApplication::processEvents();
if (root_N->dim == 2) {
- // FIXME
+ PRINTF(" Top level object is a 2D object.");
+ PRINTF(" Empty: %6s", root_N->p2.is_empty() ? "yes" : "no");
+ PRINTF(" Plane: %6s", root_N->p2.is_plane() ? "yes" : "no");
}
if (root_N->dim == 3) {
@@ -1192,7 +1194,39 @@ static void renderGLviaCGAL(void *vp)
delete p;
m->cgal_ogl_p = NULL;
}
- if (m->root_N && m->root_N->dim == 3) {
+ if (m->root_N && m->root_N->dim == 2)
+ {
+ typedef CGAL_Nef_polyhedron2::Explorer Explorer;
+ typedef Explorer::Face_const_iterator fci_t;
+ typedef Explorer::Halfedge_around_face_const_circulator heafcc_t;
+ typedef Explorer::Point Point;
+ Explorer E = m->root_N->p2.explorer();
+
+ for (fci_t fit = E.faces_begin(), fend = E.faces_end(); fit != fend; ++fit)
+ {
+ bool fset = false;
+ double fx = 0.0, fy = 0.0;
+ heafcc_t fcirc(E.halfedge(fit)), fend(fcirc);
+ CGAL_For_all(fcirc, fend) {
+ if(E.is_standard(E.target(fcirc))) {
+ Point p = E.point(E.target(fcirc));
+ double x = to_double(p.x()), y = to_double(p.y());
+ if (!fset) {
+ glBegin(GL_LINE_STRIP);
+ fx = x, fy = y;
+ fset = true;
+ }
+ glVertex3d(x, y, 0.0);
+ }
+ }
+ if (fset) {
+ glVertex3d(fx, fy, 0.0);
+ glEnd();
+ }
+ }
+ }
+ if (m->root_N && m->root_N->dim == 3)
+ {
CGAL::OGL::Polyhedron *p = (CGAL::OGL::Polyhedron*)m->cgal_ogl_p;
if (!p) {
m->cgal_ogl_p = p = new CGAL::OGL::Polyhedron();
contact: Jan Huwald // Impressum