mirror of https://github.com/vitalif/openscad
fix bounding box function definition errors
parent
a563c84bcf
commit
d847039c96
|
@ -3,10 +3,12 @@
|
||||||
#include "OffscreenView.h"
|
#include "OffscreenView.h"
|
||||||
#include "CsgInfo.h"
|
#include "CsgInfo.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "polyset.h"
|
||||||
|
|
||||||
|
#ifdef ENABLE_CGAL
|
||||||
#include "CGALRenderer.h"
|
#include "CGALRenderer.h"
|
||||||
#include "CGAL_renderer.h"
|
#include "CGAL_renderer.h"
|
||||||
#include "cgal.h"
|
#include "cgal.h"
|
||||||
#ifdef ENABLE_CGAL
|
|
||||||
|
|
||||||
void export_png_with_cgal(CGAL_Nef_polyhedron *root_N, std::ostream &output)
|
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;
|
BoundingBox bbox;
|
||||||
if (cgalRenderer.polyhedron) {
|
if (cgalRenderer.polyhedron) {
|
||||||
CGAL::Bbox_3 cgalbbox = cgalRenderer.polyhedron->bbox();
|
CGAL::Bbox_3 cgalbbox = cgalRenderer.polyhedron->bbox();
|
||||||
bbox = BoundingBox(Vector3d(cgalbbox.xmin(), cgalbbox.ymin(), cgalbbox.zmin()),
|
bbox = BoundingBox(
|
||||||
Vector3d(cgalbbox.xmax(), cgalbbox.ymax(), cgalbbox.zmax()));
|
Vector3d(cgalbbox.xmin(), cgalbbox.ymin(), cgalbbox.zmin()),
|
||||||
|
Vector3d(cgalbbox.xmax(), cgalbbox.ymax(), cgalbbox.zmax()) );
|
||||||
}
|
}
|
||||||
else if (cgalRenderer.polyset) {
|
else if (cgalRenderer.polyset) {
|
||||||
bbox = cgalRenderer.polyset->getBoundingBox();
|
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 cameradir(1, 1, -0.5);
|
||||||
Vector3d camerapos = center - radius*2*cameradir;
|
Vector3d camerapos = center - radius*2*cameradir;
|
||||||
|
output << center << "\n";
|
||||||
|
output << radius << "\n";
|
||||||
/*
|
/*
|
||||||
csgInfo.glview->setCamera(camerapos, center);
|
csgInfo.glview->setCamera(camerapos, center);
|
||||||
csgInfo.glview->setRenderer(&cgalRenderer);
|
csgInfo.glview->setRenderer(&cgalRenderer);
|
||||||
|
|
|
@ -46,3 +46,15 @@ bool matrix_contains_nan( const Transform3d &m )
|
||||||
return false;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
14
src/linalg.h
14
src/linalg.h
|
@ -22,18 +22,8 @@ bool matrix_contains_infinity( const Transform3d &m );
|
||||||
bool matrix_contains_nan( const Transform3d &m );
|
bool matrix_contains_nan( const Transform3d &m );
|
||||||
|
|
||||||
BoundingBox operator*(const Transform3d &m, const BoundingBox &box);
|
BoundingBox operator*(const Transform3d &m, const BoundingBox &box);
|
||||||
|
Vector3d getBoundingCenter(BoundingBox bbox);
|
||||||
Vector3d getBoundingCenter(BoundingBox bbox)
|
double getBoundingRadius(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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class Color4f : public Eigen::Vector4f
|
class Color4f : public Eigen::Vector4f
|
||||||
|
|
Loading…
Reference in New Issue