Oops, forgot to consider scale (pixels/mm) for translation from

six-DOF mouse.

[git-p4: depot-paths = "//depot/solvespace/": change = 2022]
This commit is contained in:
Jonathan Westhues 2009-07-25 17:29:56 -08:00
parent 806c3d8cde
commit 36182448ce
2 changed files with 9 additions and 9 deletions

View File

@ -294,9 +294,9 @@ void GraphicsWindow::SpaceNavigatorMoved(double tx, double ty, double tz,
// Apply the transformation to an imported part. Gain down the Z
// axis, since it's hard to see what you're doing on that one since
// it's normal to the screen.
Vector t = projRight.ScaledBy(tx).Plus(
projUp .ScaledBy(ty).Plus(
out .ScaledBy(0.1*tz)));
Vector t = projRight.ScaledBy(tx/scale).Plus(
projUp .ScaledBy(ty/scale).Plus(
out .ScaledBy(0.1*tz/scale)));
Quaternion q = Quaternion::From(aa, aam);
// If we go five seconds without SpaceNavigator input, or if we've
@ -320,9 +320,9 @@ void GraphicsWindow::SpaceNavigatorMoved(double tx, double ty, double tz,
// x and y components are translation; but z component is scale,
// not translation, or else it would do nothing in a parallel
// projection
offset = offset.Plus(projRight.ScaledBy(tx));
offset = offset.Plus(projUp.ScaledBy(ty));
scale *= exp(0.01*tz);
offset = offset.Plus(projRight.ScaledBy(tx/scale));
offset = offset.Plus(projUp.ScaledBy(ty/scale));
scale *= exp(0.001*tz);
if(aam != 0.0) {
projRight = projRight.RotatedAbout(aa, -aam);

View File

@ -1064,9 +1064,9 @@ static BOOL ProcessSpaceNavigatorMsg(MSG *msg) {
if(sse.type == SI_MOTION_EVENT) {
// The Z axis translation and rotation are both
// backwards in the default mapping.
double tx = sse.u.spwData.mData[SI_TX]*0.1,
ty = sse.u.spwData.mData[SI_TY]*0.1,
tz = -sse.u.spwData.mData[SI_TZ]*0.1,
double tx = sse.u.spwData.mData[SI_TX]*1.0,
ty = sse.u.spwData.mData[SI_TY]*1.0,
tz = -sse.u.spwData.mData[SI_TZ]*1.0,
rx = sse.u.spwData.mData[SI_RX]*0.001,
ry = sse.u.spwData.mData[SI_RY]*0.001,
rz = -sse.u.spwData.mData[SI_RZ]*0.001;