diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CGALEvaluator.cc | 17 | ||||
-rw-r--r-- | src/CGAL_Nef_polyhedron_DxfData.cc | 9 | ||||
-rw-r--r-- | src/OffscreenView.cc | 2 | ||||
-rw-r--r-- | src/cgaladv.cc | 6 |
4 files changed, 27 insertions, 7 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index a5a9d65..34f5bb6 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -185,8 +185,18 @@ CGAL_Nef_polyhedron CGALEvaluator::applyResize(const CgaladvNode &node) // Based on resize() in Giles Bathgate's RapCAD CGAL_Nef_polyhedron N; N = applyToChildren(node, CGE_UNION); + CGAL_Iso_cuboid_3 bb; + + if ( N.dim == 2 ) { + CGAL_Iso_rectangle_2e bbox = bounding_box( *N.p2 ); + CGAL_Point_2e min2(bbox.min()), max2(bbox.max()); + CGAL_Point_3 min3(min2.x(),min2.y(),0), max3(max2.x(),max2.y(),0); + bb = CGAL_Iso_cuboid_3( min3, max3 ); + } + else { + bb = bounding_box( *N.p3 ); + } - CGAL_Iso_cuboid_3 bb = bounding_box( *N.p3 ); Eigen::Matrix<NT,3,1> scale, bbox_size; scale << 1,1,1; bbox_size << bb.xmax()-bb.xmin(), bb.ymax()-bb.ymin(), bb.zmax()-bb.zmin(); @@ -197,7 +207,10 @@ CGAL_Nef_polyhedron CGALEvaluator::applyResize(const CgaladvNode &node) if (node.autosize) for (int i=0;i<3;i++) scale[i] = autoscale; - + std::cout << autoscale << " ascale \n"; + std::cout << scale[0] << ","; + std::cout << scale[1] << ","; + std::cout << scale[2] << " scalev \n"; Eigen::Matrix4d t; t << CGAL::to_double(scale[0]), 0, 0, 0, 0, CGAL::to_double(scale[1]), 0, 0, diff --git a/src/CGAL_Nef_polyhedron_DxfData.cc b/src/CGAL_Nef_polyhedron_DxfData.cc index 50a9952..8539e0e 100644 --- a/src/CGAL_Nef_polyhedron_DxfData.cc +++ b/src/CGAL_Nef_polyhedron_DxfData.cc @@ -96,17 +96,21 @@ std::string CGAL_Nef_polyhedron::dump() const void CGAL_Nef_polyhedron::transform( const Transform3d &matrix ) { + std::cout << matrix(0,0) << "," << matrix(1,0) << "," << matrix(2,0) << "," << matrix(3,0) << "\n"; + std::cout << matrix(0,1) << "," << matrix(1,1) << "," << matrix(2,1) << "," << matrix(3,1) << "\n"; + std::cout << matrix(0,2) << "," << matrix(1,2) << "," << matrix(2,2) << "," << matrix(3,2) << "\n"; + std::cout << matrix(0,3) << "," << matrix(1,3) << "," << matrix(2,3) << "," << matrix(3,3) << "\n"; if (!this->isNull()) { if (this->dim == 2) { // Unfortunately CGAL provides no transform method for CGAL_Nef_polyhedron2 // objects. So we convert in to our internal 2d data format, transform it, // tesselate it and create a new CGAL_Nef_polyhedron2 from it.. What a hack! - Eigen::Matrix2f testmat; testmat << matrix(0,0), matrix(0,1), matrix(1,0), matrix(1,1); if (testmat.determinant() == 0) { PRINT("Warning: Scaling a 2D object with 0 - removing object"); this->reset(); + return; } else { CGAL_Aff_transformation2 t( @@ -128,8 +132,7 @@ void CGAL_Nef_polyhedron::transform( const Transform3d &matrix ) Tree nulltree; CGALEvaluator tmpeval(nulltree); CGAL_Nef_polyhedron N = tmpeval.evaluateCGALMesh(ps); - this->p2.reset(); - *(this->p2) = *(N.p2); + this->p2.reset( new CGAL_Nef_polyhedron2( *N.p2 ) ); delete dd; } } diff --git a/src/OffscreenView.cc b/src/OffscreenView.cc index 430d4ea..1e91f3d 100644 --- a/src/OffscreenView.cc +++ b/src/OffscreenView.cc @@ -23,7 +23,7 @@ OffscreenView::~OffscreenView() #ifdef ENABLE_OPENCSG void OffscreenView::display_opencsg_warning() { - fprintf(stderr, "OpenSCAD recommended OpenGL version is 2.0. \n"); + PRINT("OpenSCAD recommended OpenGL version is 2.0."); } #endif diff --git a/src/cgaladv.cc b/src/cgaladv.cc index 276b59c..199ace2 100644 --- a/src/cgaladv.cc +++ b/src/cgaladv.cc @@ -155,7 +155,11 @@ std::string CgaladvNode::toString() const stream << "()"; break; case RESIZE: - stream << "(newsize = " << this->newsize << ")"; + stream << "(newsize = [" + << this->newsize[0] << "," + << this->newsize[1] << "," + << this->newsize[2] << "]" + << ", auto = " << this->autosize << ")"; break; default: assert(false); |