Skip to content
Snippets Groups Projects
Commit dd6d83b4 authored by Daniel Savchenko's avatar Daniel Savchenko
Browse files

Slicer now uses Mesh for Boundingbox, instead of Scenegraph

parent 271c5079
No related tags found
1 merge request!2Draft: Slicer now uses Mesh for Boundingbox, instead of Scenegraph
include (plugin)
openflipper_plugin (INSTALLDATA Icons)
openflipper_plugin (INSTALLDATA Icons
TYPES POLYMESH TRIANGLEMESH)
......@@ -46,6 +46,9 @@
#include "OpenFlipper/BasePlugin/PluginFunctions.hh"
#include <OpenFlipper/common/GlobalOptions.hh>
#include <ObjectTypes/PolyMesh/PolyMesh.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
#include <MeshTools/MeshInfoT.hh>
SlicePlugin::SlicePlugin() :
tool_(nullptr),
......@@ -177,13 +180,24 @@ void SlicePlugin::getBoundingBox(ACG::Vec3d& bbmin, ACG::Vec3d& bbmax){
else
restriction = PluginFunctions::ALL_OBJECTS;
for ( PluginFunctions::ObjectIterator o_it(restriction,DataType(DATA_ALL)) ;
for ( PluginFunctions::ObjectIterator o_it(restriction,DataType(DATA_TRIANGLE_MESH | DATA_POLY_MESH));
o_it != PluginFunctions::objectsEnd(); ++o_it) {
// get scene size
ACG::Vec3d cur_min;
ACG::Vec3d cur_max;
o_it->getBoundingBox(cur_min, cur_max);
if (o_it->dataType(DATA_TRIANGLE_MESH)){
TriMesh* mesh = PluginFunctions::triMesh(*o_it);
MeshInfo::getBoundingBox(mesh, cur_min, cur_max);
}
else if (o_it->dataType(DATA_POLY_MESH)){
PolyMesh* mesh = PluginFunctions::polyMesh(*o_it);
MeshInfo::getBoundingBox(mesh, cur_min, cur_max);
}
else{
std::cerr << "Error: Object is not a mesh! This should not be possible." << std::endl;
continue;
}
if (firstRound){
bbmin = cur_min;
......@@ -200,7 +214,7 @@ void SlicePlugin::getBoundingBox(ACG::Vec3d& bbmin, ACG::Vec3d& bbmax){
}
if ((bbmin[0] > bbmax[0]) || (bbmin[1] > bbmax[1]) || (bbmin[2] > bbmax[2]))
std::cerr << "Error while computing bounding box!";
std::cerr << "Error while computing bounding box! There is probably no Mesh selected!" << std::endl;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment