new algorithm for spaceball movements

*consolidate motion3 event handeling.
*rotation about focal point.
*translation based on world to screen scale.
*cleanup axes map and constants.
This commit is contained in:
tanderson
2012-02-28 10:42:17 -05:00
parent c3647b3baa
commit 9ffdfbe485
7 changed files with 61 additions and 69 deletions

View File

@@ -1070,18 +1070,16 @@ void View3DInventorViewer::processEvent(QEvent * event)
motionEvent->setHandled(true);
static float translationConstant(-.001f);
float xTrans, yTrans, zTrans;
xTrans = static_cast<float>(motionEvent->translationX());
yTrans = static_cast<float>(motionEvent->translationY());
zTrans = static_cast<float>(motionEvent->translationZ());
SbVec3f translationVector(xTrans, yTrans, zTrans * -1.0);
translationVector *= translationConstant;
SbVec3f translationVector(xTrans, yTrans, zTrans);
static float rotationConstant(.0001f);
SbRotation xRot, yRot, zRot;
xRot.setValue(SbVec3f(-1.0, 0.0, 0.0), static_cast<float>(motionEvent->rotationX()) * rotationConstant);
yRot.setValue(SbVec3f(0.0, -1.0, 0.0), static_cast<float>(motionEvent->rotationY()) * rotationConstant);
xRot.setValue(SbVec3f(1.0, 0.0, 0.0), static_cast<float>(motionEvent->rotationX()) * rotationConstant);
yRot.setValue(SbVec3f(0.0, 1.0, 0.0), static_cast<float>(motionEvent->rotationY()) * rotationConstant);
zRot.setValue(SbVec3f(0.0, 0.0, 1.0), static_cast<float>(motionEvent->rotationZ()) * rotationConstant);
SoMotion3Event motion3Event;