Skip to content

Commit

Permalink
consider Bound in centerScene()
Browse files Browse the repository at this point in the history
  • Loading branch information
cosurgi committed Apr 12, 2015
1 parent 1b53a0c commit 963bf0f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gui/qt4/GLViewer.cpp
Expand Up @@ -14,6 +14,7 @@
#include<lib/opengl/OpenGLWrapper.hpp>
#include<core/Body.hpp>
#include<core/Scene.hpp>
#include<core/Bound.hpp>
#include<core/Interaction.hpp>
#include<core/DisplayParameters.hpp>
#include<boost/algorithm/string.hpp>
Expand Down Expand Up @@ -370,6 +371,11 @@ void GLViewer::centerScene(){
if(!b) continue;
max=max.cwiseMax(b->state->pos);
min=min.cwiseMin(b->state->pos);
Bound* aabb=dynamic_cast<Bound*>(b->bound.get());
if(aabb){
max=max.cwiseMax(b->state->pos+aabb->max);
min=min.cwiseMin(b->state->pos+aabb->min);
}
}
if(isinf(min[0])||isinf(min[1])||isinf(min[2])||isinf(max[0])||isinf(max[1])||isinf(max[2])){ LOG_DEBUG("No min/max computed from bodies either, setting cube (-1,-1,-1)×(1,1,1)"); min=-Vector3r::Ones(); max=Vector3r::Ones(); }
} else {LOG_DEBUG("Using scene's Aabb");}
Expand Down

0 comments on commit 963bf0f

Please sign in to comment.