From: Simon C Mills (simon++at++wgs.estec.esa.nl)
Date: 04/11/2001 00:20:37
Ruxandra Cojocaru wrote:
>
> Please tell me how can I isolate the simple
> transformations (translation, rotation, scale )
> from the general transformation matrix .
>
> Until now I observe that the last row from the matrix
> represents the translation. But still remains the
> problem of rotation and translation.
>
> Thank You,
> Ruxi.
This had been discussed not long ago. Check the archives. For example:
> Mark Evans wrote:
> >
> > Is it possible to retrieve the rotation, translation
> > and scale for a pfDCS ( or pfSCS) separately? You can
>
> yes,
>
> to get orientation of matrix m:
>
> pfQuat q;
> m.getOrthoQuat(q);
>
> to get translation:
>
> pfVec3 t;
> m.getRow(3, t);
>
> to get scale in x-direction:
> pfVec3 r;
> m.getRow(0, r);
> float scale = r.length()
>
>
> > set separately the translation, rotation and scale for
> > a pfDCS (through pfDCSTrans, pfDCSRot, pfDCSScale,
> > pfDCSScaleXYZ), but you can only retrieve the matrix
> > of a pfDCS (pfGetDCSMat). Is it possible to retrieve,
> > from this matrix, the translation, rotation and scale?
> > I've tried to use pfGetOrthoMatCoord, but it would
> > only get me the translation and rotation, not the
> > scale.
> > Is there a unique solution, or could different
> > rotations+scales to give the same result?
> > Also, if I want to "animate" a pfDCS from pfMatrix m1
> > to pfMatrix m2 through linear interpolation, is it
> > correct to linearly interpolate each of the 16
> > coefficients of the matrix for the pfDCS between the
>
> Absolutely not.
>
> > source and destination matrices? Is there a better (or
> > correct) way?
>
> You need to extract the scale, orient, and translation
> seperately, and interpolate them seperately.
>
> quaternions have ::slerp (linear interpolation) and
> also quadratic. However, I could not get the quadratic
> interpolation of pfQuats to work properly. Not sure if
> this is a performer problem, or a fault in my code.
>
> scalars and vectors can be interpolated quite simply,
> both linearly, and with splines.
>
> For my apps, I use hermite splines to interpolate scalars
> and vectors. For quats, I use ::slerp().
>
> After interpolation of the 3 components, you need to
> reassemble them into a single matrix. I use this
> code to do this:
>
> void TransformAnimator::Evaluate(float time)
> {
> pfVec3 p = PosInterp.Evaluate(time);
> pfQuat q = OriInterp.Evaluate(time);
> float s=1.0;
> if (SclInterp.GetEventCount())
> s = SclInterp.Evaluate(time);
> pfMatrix m;
> m.makeQuat(q);
> m.setRow(3,p);
> if (s!=1.0)
> m.preScale(s,s,s,m);
> TargetDCS.setMat(m);
> }
>
> PosInterp, SclInterp and OriInterp are my custom classes,
> and do the interpolation of vectors, scalars and quats.
>
> Note: I assume uniform scaling.
> Personally I think non-uniform-scaling is really bad, and you
> should not use it at all.
>
> Bram Stolk
Regards, Simon
_______________________________________________________________________
Simon Mills
Silicon Worlds S.A.
c/o Modelling & Simulation Section (TOS-EMM) Tel: +31 (0)71 565 3725
European Space Agency (ESA/ESTEC) Fax: +31 (0)71 565 5419
Postbus 299, 2200AG Noordwijk e-mail: simon++at++wgs.estec.esa.nl
The Netherlands http://www.estec.esa.nl/wmwww/EMM
_______________________________________________________________________
This archive was generated by hypermail 2b29 : Wed Apr 11 2001 - 00:16:45 PDT