diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CGALEvaluator.cc | 13 | ||||
-rw-r--r-- | src/CGAL_Nef_polyhedron.h | 2 | ||||
-rw-r--r-- | src/cgal.h | 10 | ||||
-rw-r--r-- | src/cgalutils.cc | 3 | ||||
-rw-r--r-- | src/cgalutils.h | 2 | ||||
-rw-r--r-- | src/svg.cc | 40 |
6 files changed, 37 insertions, 33 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index 686bde1..8e1b5eb 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -202,30 +202,31 @@ CGAL_Nef_polyhedron CGALEvaluator::applyResize(const CgaladvNode &node) 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); + CGAL_Point_3 min3(CGAL::to_double(min2.x()), CGAL::to_double(min2.y()), 0), + max3(CGAL::to_double(max2.x()), CGAL::to_double(max2.y()), 0); bb = CGAL_Iso_cuboid_3( min3, max3 ); } else { bb = bounding_box( *N.p3 ); } - std::vector<NT> scale, bbox_size; - for (int i=0;i<3;i++) scale.push_back( NT(1) ); + std::vector<NT3> scale, bbox_size; + for (int i=0;i<3;i++) scale.push_back( NT3(1) ); bbox_size.push_back( bb.xmax()-bb.xmin() ); bbox_size.push_back( bb.ymax()-bb.ymin() ); bbox_size.push_back( bb.zmax()-bb.zmin() ); for (int i=0;i<3;i++) { if (node.newsize[i]) { - if (bbox_size[i]==NT(0)) { + if (bbox_size[i]==NT3(0)) { PRINT("WARNING: Cannot resize in direction normal to flat object"); return N; } else { - scale[i] = NT(node.newsize[i]) / bbox_size[i]; + scale[i] = NT3(node.newsize[i]) / bbox_size[i]; } } } - NT autoscale = std::max( scale[0], std::max( scale[1], scale[2] )); + NT3 autoscale = std::max( scale[0], std::max( scale[1], scale[2] )); for (int i=0;i<3;i++) { if (node.autosize[i]) scale[i] = autoscale; } diff --git a/src/CGAL_Nef_polyhedron.h b/src/CGAL_Nef_polyhedron.h index cfab993..7f59861 100644 --- a/src/CGAL_Nef_polyhedron.h +++ b/src/CGAL_Nef_polyhedron.h @@ -1,7 +1,7 @@ #ifndef CGAL_NEF_POLYHEDRON_H_ #define CGAL_NEF_POLYHEDRON_H_ -#include "cgalfwd.h" +#include "cgal.h" #include "memory.h" #include <string> #include "linalg.h" @@ -39,8 +39,8 @@ using boost::uintmax_t; #include <CGAL/assertions_behaviour.h> #include <CGAL/exceptions.h> -typedef CGAL::Gmpq NT; -typedef CGAL::Extended_cartesian<NT> CGAL_Kernel2; +typedef CGAL::Gmpq NT2; +typedef CGAL::Extended_cartesian<NT2> CGAL_Kernel2; typedef CGAL::Nef_polyhedron_2<CGAL_Kernel2> CGAL_Nef_polyhedron2; typedef CGAL_Kernel2::Aff_transformation_2 CGAL_Aff_transformation2; @@ -48,7 +48,9 @@ typedef CGAL::Exact_predicates_exact_constructions_kernel CGAL_ExactKernel2; typedef CGAL::Polygon_2<CGAL_ExactKernel2> CGAL_Poly2; typedef CGAL::Polygon_with_holes_2<CGAL_ExactKernel2> CGAL_Poly2h; -typedef CGAL::Cartesian<NT> CGAL_Kernel3; + //typedef CGAL::Cartesian<NT> CGAL_Kernel3; +typedef CGAL::Exact_predicates_exact_constructions_kernel CGAL_Kernel3; +typedef CGAL::Exact_predicates_exact_constructions_kernel::FT NT3; typedef CGAL::Nef_polyhedron_3<CGAL_Kernel3> CGAL_Nef_polyhedron3; typedef CGAL_Nef_polyhedron3::Aff_transformation_3 CGAL_Aff_transformation; @@ -63,7 +65,7 @@ typedef CGAL::Iso_cuboid_3<CGAL_Kernel3> CGAL_Iso_cuboid_3; // CGAL_Nef_polyhedron2::Explorer::Point which is different than // CGAL_Kernel2::Point. Hence the suffix 'e' typedef CGAL_Nef_polyhedron2::Explorer::Point CGAL_Point_2e; -typedef CGAL::Iso_rectangle_2< CGAL::Simple_cartesian<NT> > CGAL_Iso_rectangle_2e; +typedef CGAL::Iso_rectangle_2<CGAL::Simple_cartesian<NT2> > CGAL_Iso_rectangle_2e; #ifdef PREV_NDEBUG diff --git a/src/cgalutils.cc b/src/cgalutils.cc index 8b4c476..bb46f1c 100644 --- a/src/cgalutils.cc +++ b/src/cgalutils.cc @@ -193,7 +193,8 @@ void ZRemover::visit( CGAL_Nef_polyhedron3::Halffacet_const_handle hfacet ) std::vector<CGAL_Nef_polyhedron2::Explorer::Point> contour; CGAL_For_all( c1, cend ) { CGAL_Nef_polyhedron3::Point_3 point3d = c1->source()->target()->point(); - CGAL_Nef_polyhedron2::Explorer::Point point2d( point3d.x(), point3d.y() ); + CGAL_Nef_polyhedron2::Explorer::Point point2d(CGAL::to_double(point3d.x()), + CGAL::to_double(point3d.y())); contour.push_back( point2d ); } if (contour.size()==0) continue; diff --git a/src/cgalutils.h b/src/cgalutils.h index 6ea7711..d25fd4c 100644 --- a/src/cgalutils.h +++ b/src/cgalutils.h @@ -1,7 +1,7 @@ #ifndef CGALUTILS_H_ #define CGALUTILS_H_ -#include <cgalfwd.h> +#include <cgal.h> class PolySet *createPolySetFromPolyhedron(const CGAL_Polyhedron &p); CGAL_Polyhedron *createPolyhedronFromPolySet(const class PolySet &ps); CGAL_Iso_cuboid_3 bounding_box( const CGAL_Nef_polyhedron3 &N ); @@ -70,29 +70,29 @@ std::string svg_axes() return out.str(); } -CGAL_Point_2e project_svg_3to2( CGAL_Point_3 p, CGAL_Iso_cuboid_3 bbox ) +CGAL_Nef_polyhedron2::Explorer::Point project_svg_3to2( CGAL_Point_3 p, CGAL_Iso_cuboid_3 bbox ) { - NT screenw(svg_px_width); - NT screenh(svg_px_height); - NT screenxc = screenw / 2; - NT screenyc = screenh / 2; - NT bboxx = ( bbox.xmax() - bbox.xmin() ); - NT bboxy = ( bbox.ymax() - bbox.ymin() ); - NT bboxz = ( bbox.zmax() - bbox.zmin() ); - NT largest_dim = CGAL::max( CGAL::max( bboxx, bboxy ), bboxz ); - NT bboxxc = bboxx / 2 + bbox.xmin(); - NT bboxyc = bboxy / 2 + bbox.ymin(); - NT bboxzc = bboxz / 2 + bbox.zmin(); - NT xinbox = ( p.x() - bboxxc ) / largest_dim; - NT yinbox = ( p.y() - bboxyc ) / largest_dim; - NT zinbox = ( p.z() - bboxzc ) / largest_dim; + CGAL_Kernel3::FT screenw(svg_px_width); + CGAL_Kernel3::FT screenh(svg_px_height); + CGAL_Kernel3::FT screenxc = screenw / 2; + CGAL_Kernel3::FT screenyc = screenh / 2; + CGAL_Kernel3::FT bboxx = ( bbox.xmax() - bbox.xmin() ); + CGAL_Kernel3::FT bboxy = ( bbox.ymax() - bbox.ymin() ); + CGAL_Kernel3::FT bboxz = ( bbox.zmax() - bbox.zmin() ); + CGAL_Kernel3::FT largest_dim = CGAL::max( CGAL::max( bboxx, bboxy ), bboxz ); + CGAL_Kernel3::FT bboxxc = bboxx / 2 + bbox.xmin(); + CGAL_Kernel3::FT bboxyc = bboxy / 2 + bbox.ymin(); + CGAL_Kernel3::FT bboxzc = bboxz / 2 + bbox.zmin(); + CGAL_Kernel3::FT xinbox = ( p.x() - bboxxc ) / largest_dim; + CGAL_Kernel3::FT yinbox = ( p.y() - bboxyc ) / largest_dim; + CGAL_Kernel3::FT zinbox = ( p.z() - bboxzc ) / largest_dim; // do simple fake paralell projection - NT tx = screenxc + xinbox * screenw / 1.618 + yinbox * screenh / 3.2; - NT ty = screenyc - zinbox * screenh / 1.618 - yinbox * screenh / 3.2; - return CGAL_Point_2e( tx, ty ); + CGAL_Kernel3::FT tx = screenxc + xinbox * screenw / 1.618 + yinbox * screenh / 3.2; + CGAL_Kernel3::FT ty = screenyc - zinbox * screenh / 1.618 - yinbox * screenh / 3.2; + return CGAL_Point_2e(CGAL::to_double(tx), CGAL::to_double(ty)); } -CGAL_Point_2e project_svg_2to2( CGAL_Point_2e p, CGAL_Iso_rectangle_2e bbox ) +CGAL_Point_2e project_svg_2to2(const CGAL_Point_2e &p, const CGAL_Iso_rectangle_2e &bbox) { double screenw = svg_px_width; double screenh = svg_px_height; @@ -122,7 +122,7 @@ std::string dump_cgal_nef_polyhedron2_face_svg( std::stringstream out; CGAL_For_all(c1, c2) { if ( explorer.is_standard( explorer.target(c1) ) ) { - CGAL_Point_2e source = explorer.point( explorer.source( c1 ) ); +CGAL_Nef_polyhedron2::Explorer::Point source = explorer.point( explorer.source( c1 ) ); CGAL_Point_2e target = explorer.point( explorer.target( c1 ) ); out << " <!-- Halfedge. Mark: " << c1->mark() << " -->\n"; std::string he_mark = boost::lexical_cast<std::string>(c1->mark()); |