summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/PolySetCGALEvaluator.cc3
-rw-r--r--src/cgal.h5
-rw-r--r--src/svg.cc40
3 files changed, 25 insertions, 23 deletions
diff --git a/src/PolySetCGALEvaluator.cc b/src/PolySetCGALEvaluator.cc
index 224e657..be8ecc0 100644
--- a/src/PolySetCGALEvaluator.cc
+++ b/src/PolySetCGALEvaluator.cc
@@ -86,7 +86,8 @@ public:
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 );
}
diff --git a/src/cgal.h b/src/cgal.h
index a7300c6..366dbff 100644
--- a/src/cgal.h
+++ b/src/cgal.h
@@ -48,7 +48,8 @@ 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::Nef_polyhedron_3<CGAL_Kernel3> CGAL_Nef_polyhedron3;
typedef CGAL_Nef_polyhedron3::Aff_transformation_3 CGAL_Aff_transformation;
@@ -63,7 +64,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<NT> > CGAL_Iso_rectangle_2e;
#ifdef PREV_NDEBUG
diff --git a/src/svg.cc b/src/svg.cc
index e5130b0..a5d5ac2 100644
--- a/src/svg.cc
+++ b/src/svg.cc
@@ -49,29 +49,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;
@@ -99,7 +99,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 ) );
CGAL_Point_2e tp1 = project_svg_2to2( source, bbox );
CGAL_Point_2e tp2 = project_svg_2to2( target, bbox );
contact: Jan Huwald // Impressum