fix bounding box function definition errors

felipesanches-svg
don bright 2013-01-24 04:57:55 +01:00
parent a563c84bcf
commit d847039c96
3 changed files with 22 additions and 15 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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