Re: Adding a 3d tracker to perfly.

New Message Reply Date view Thread view Subject view Author view

Edward Peters (elpeters++at++ncsa.uiuc.edu)
Tue, 31 Dec 1996 10:51:44 -0600


> 1: If I have a view to and view up vector, how do I get the HPR values
> used by pfChanViewOffsets?

If you get your view right vector and normalize all your view vectors, you can
do something like this:

        // build a matrix with three orthonormal vectors
        pfMatrix myMat;
        myMat.setRow(0,rightVec);
        myMat.setRow(1,frontVec);
        myMat.setRow(2,upVec);

        pfCoord myCoord;
        myMat.getOrthoCoord(&myCoord);
        heading = myCoord.hpr[0];
        pitch = myCoord.hpr[1];
        roll = myCoord.hpr[2];

> 2: If I have a DCS object (sceneDCS) which is translated to a point
> x,y,z. How do I rotate the DCS about the origin?
>
> 2a: How do you rotate a DCS node about an arbitrary point.

Question 2 is just a specific case of question 2a. You should check out the
pfMatrix and pfDCS man pages. You can get the matrix of your DCS node:

        pfMatrix DCSmat;
        myDCS->getMat(&DCSmat);

You can build a rotation matrix:

        pfMatrix myMat;
        myMat.makeRot(90,0,0,1);

for example, which makes myMat into the matrix which rotates 90 degrees around
the positive Z axis at the origin.
Then you pre-multiply the DCS matrix by this rotation matrix and store the
results:

        DCSmat.preMult(myMat);
        myDCS->setMat(DCSmat);

Hope this helps. Happy Performing.

Ed Peters
elpeters++at++ncsa.uiuc.edu
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
            Submissions: info-performer++at++sgi.com
        Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:54:13 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.