diff options
author | don bright <hugh.m.bright@gmail.com> | 2013-01-24 03:57:55 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2013-01-24 03:57:55 (GMT) |
commit | d847039c96641f564d805c57824bad422d68ec0d (patch) | |
tree | c4efea58024d4651213db378af8619ed7848cbef /src | |
parent | a563c84bcfc36c3c2ab165386df3483b4063768b (diff) |
fix bounding box function definition errors
Diffstat (limited to 'src')
-rw-r--r-- | src/export_png.cc | 11 | ||||
-rw-r--r-- | src/linalg.cc | 12 | ||||
-rw-r--r-- | src/linalg.h | 14 |
3 files changed, 22 insertions, 15 deletions
diff --git a/src/export_png.cc b/src/export_png.cc index 25e99a0..aa23ee7 100644 --- a/src/export_png.cc +++ b/src/export_png.cc @@ -3,10 +3,12 @@ #include "OffscreenView.h" #include "CsgInfo.h" #include <stdio.h> +#include "polyset.h" + +#ifdef ENABLE_CGAL #include "CGALRenderer.h" #include "CGAL_renderer.h" #include "cgal.h" -#ifdef ENABLE_CGAL void export_png_with_cgal(CGAL_Nef_polyhedron *root_N, std::ostream &output) { @@ -21,8 +23,9 @@ void export_png_with_cgal(CGAL_Nef_polyhedron *root_N, std::ostream &output) BoundingBox bbox; if (cgalRenderer.polyhedron) { CGAL::Bbox_3 cgalbbox = cgalRenderer.polyhedron->bbox(); - bbox = BoundingBox(Vector3d(cgalbbox.xmin(), cgalbbox.ymin(), cgalbbox.zmin()), - Vector3d(cgalbbox.xmax(), cgalbbox.ymax(), cgalbbox.zmax())); + bbox = BoundingBox( + Vector3d(cgalbbox.xmin(), cgalbbox.ymin(), cgalbbox.zmin()), + Vector3d(cgalbbox.xmax(), cgalbbox.ymax(), cgalbbox.zmax()) ); } else if (cgalRenderer.polyset) { bbox = cgalRenderer.polyset->getBoundingBox(); @@ -33,6 +36,8 @@ void export_png_with_cgal(CGAL_Nef_polyhedron *root_N, std::ostream &output) Vector3d cameradir(1, 1, -0.5); Vector3d camerapos = center - radius*2*cameradir; + output << center << "\n"; + output << radius << "\n"; /* csgInfo.glview->setCamera(camerapos, center); csgInfo.glview->setRenderer(&cgalRenderer); diff --git a/src/linalg.cc b/src/linalg.cc index 2f368f9..590e01b 100644 --- a/src/linalg.cc +++ b/src/linalg.cc @@ -46,3 +46,15 @@ bool matrix_contains_nan( const Transform3d &m ) return false; } +double getBoundingRadius(BoundingBox bbox) +{ + double radius = (bbox.max() - bbox.min()).norm() / 2; + return radius; // 0; +} + +Vector3d getBoundingCenter(BoundingBox bbox) +{ + Vector3d center = (bbox.min() + bbox.max()) / 2; + return center; // Vector3d(0,0,0); +} + diff --git a/src/linalg.h b/src/linalg.h index 129ed3f..1f9ed30 100644 --- a/src/linalg.h +++ b/src/linalg.h @@ -22,18 +22,8 @@ bool matrix_contains_infinity( const Transform3d &m ); bool matrix_contains_nan( const Transform3d &m ); BoundingBox operator*(const Transform3d &m, const BoundingBox &box); - -Vector3d getBoundingCenter(BoundingBox bbox) -{ - Vector3d center = (bbox.min() + bbox.max()) / 2; - return center; // Vector3d(0,0,0); -} - -double getBoundingRadius(BoundingBox bbox) -{ - double radius = (bbox.max() - bbox.min()).norm() / 2; - return radius; // 0; -} +Vector3d getBoundingCenter(BoundingBox bbox); +double getBoundingRadius(BoundingBox bbox); class Color4f : public Eigen::Vector4f |