Skip to content

Commit

Permalink
+ do not apply corrupted transformation (NaN) from SoCenterballManip
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Aug 11, 2014
1 parent b8df459 commit 29f3f0c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Gui/ViewProviderGeometryObject.cpp
Expand Up @@ -52,6 +52,7 @@
#include "Document.h"
#include "Window.h"

#include <Base/Console.h>
#include <Base/Placement.h>
#include <App/PropertyGeo.h>
#include <App/GeoFeature.h>
Expand All @@ -62,6 +63,7 @@
#endif
#include "SoNavigationDragger.h"
#include "SoFCUnifiedSelection.h"
#include <boost/math/special_functions/fpclassify.hpp>

using namespace Gui;

Expand Down Expand Up @@ -190,6 +192,7 @@ void ViewProviderGeometryObject::updateData(const App::Property* prop)
pcTransform->rotation.setValue(q0,q1,q2,q3);
pcTransform->translation.setValue(px,py,pz);
pcTransform->center.setValue(0.0f,0.0f,0.0f);
pcTransform->scaleFactor.setValue(1.0f,1.0f,1.0f);
}
}

Expand Down Expand Up @@ -445,6 +448,12 @@ void ViewProviderGeometryObject::dragMotionCallback(void * data, SoDragger * d)
SbVec3f center = manip->center.getValue();
manip->rotation.getValue().getValue(q0, q1, q2, q3);

// it can happen that the values of the motion matrix is garbage
if (boost::math::isnan(q0)) {
Base::Console().Warning("NaN values received in ViewProviderGeometryObject::dragMotionCallback\n");
return;
}

// get the placement
ViewProviderGeometryObject* view = reinterpret_cast<ViewProviderGeometryObject*>(data);
if (view && view->pcObject && view->pcObject->getTypeId().isDerivedFrom(App::GeoFeature::getClassTypeId())) {
Expand Down

0 comments on commit 29f3f0c

Please sign in to comment.