Ebonair
unread,May 23, 2012, 6:52:29 PM5/23/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to vrjuggler-questions
I'm trying to get the orientation of our wand device. Right now I can
extract the position no problem, but the orientation isn't working
properly:
Matrix44f wandMatrix;//4x4 translational matrix representing
wand position
gmtl::Point3f wandPoint;//gtml representation of the wand's position
gmtl::EulerAngle<double, gmtl::XYZ> wandAngle;
//### Extract the wand position ###
wandMatrix = mWand->getData();
wandPoint = gmtl::makeTrans<gmtl::Point3f>(wandMatrix);
wandPos = Point3D(wandPoint[0], wandPoint[1], wandPoint[2]);
//### Extract the wand orientation ###
gmtl::Matrix44f invertedWandMatrix;
gmtl::invertFull(invertedWandMatrix, wandMatrix);
gmtl::Vec3f direction;
gmtl::Vec3f Zdir = gmtl::Vec3f(0.0f, 0.0f, -90.0f);
gmtl::xform(direction, invertedWandMatrix, Zdir);
cout << "Angle: " << direction[0] << ", " << direction[1] << ", " <<
direction[2] << endl;
If I do the following:
Change wand roll: no effect on any direction
Change wand pitch: affects direction[1] and direction[2]
Change wand yaw: affects direction[0] and direction[2]
How should I resolve this?