Re: DCS and matrix help needed please.

New Message Reply Date view Thread view Subject view Author view

Veraart (rioj7++at++fel.tno.nl)
Mon, 5 Aug 1996 11:55:35 +0200 (MET DST)


> > Now I have a point that is in the original Performer Coordinate system
> (vehicle[1].xyz)
> > and I want to find out what its value is in the rotated and translated DCS
> system.
>
> OK, so it sounds like you want to know where vehicle[1]'s position (in world
> coordinates) lies relative to vehicle[0]'s local coordinate system.
>
> First, figure out where the origin of vehicle[0]'s coordinate system is in
> world coordinates:
> pfGetDCSMat(vehicle[0].dcs, Matrix1);
> pfSetVec3(origin, 0, 0, 0);
> pfXformPt3(originInWorld, origin, Matrix1);
This will result in having originInWorld set to nearly the same
values as vehicle[0].xyz that are available.

> Then, calculate the difference between vehicle[1]'s position and the position
> of vehicle[0]'s local origin:
>
> xnew = vehicle[1].xyz[PF_X] - originInWorld[PF_X];
> ynew = vehicle[1].xyz[PF_Y] - originInWorld[PF_Y];
> znew = vehicle[1].xyz[PF_Z] - originInWorld[PF_Z];
This will only take into acount the translation of the DCS and not the rotation.

Because the matrix returned from pfGetDCSMat() transforms from the local
coordinate system towards the world coordinates we must have the invers
matrix if we want to get the position of vehicle[1] in the translated and
rotated coordinate system of vehicle[0].

pfGetDCSMat(vehicle[0].dcs, Matrix1);
pfInvertMat(Matrix2, Matrix1);
pfXformPt3(relPosVeh, vehicle[1].xyz, Matrix2);

Maybe you can use one of the other pfInvertxxxMat() functions, depending on
if you use scaling or not.

I haven't verified it, so if there is something wrong with this method
let us know.

Mario
=======================================================================
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:53:18 PDT

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