Veraart (rioj7++at++fel.tno.nl)
Mon, 5 Aug 1996 11:55:35 +0200 (MET DST)
> 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
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:53:18 PDT