Hi all,

I have a simple question which confuses my mind. While combining
transformations (translate/scale/rotation) I create different matrices
with Matrix::rotate/scale/translate methods. However, the
multiplication order of these single matrices in order to get the
final transformation matrix makes difference, I think. This topic have
been discussed many times may be, but I have a confusing part I tried
to explain below.

OSG Quickstart guide gives the example below:

---------------------------
To transform a Vec3 v by a rotation R around a new origin T, use the
following code:


osg::Matrix T;
T.makeTranslate( x, y, z );
osg::Matrix R;
R.makeRotate( angle, axis );
Vec3 vPrime = v * R * T;
-----------------------------

>From here I understand first translate and then rotate the point.
Therefore, premultiplying R with T, processing from right to left.

However, OSG 3.0 Beginners Guide says that:
---------------------------------------

The order of OSG row-major matrix operations is also easy to understand when
concatenating matrices, for example:
osg::Matrix mat1 = osg::Matrix::scale(sx, sy, sz);
osg::Matrix mat2 = osg::Matrix::translate(x, y, z);
osg::Matrix resultMat = mat1 * mat2;
Developers can always read the transformation process from left to
right, that is, the
resultMat means to first scale a vector with mat1, and then translate
it with mat2.
This explanation always sounds clear and comfortable.
---------------------------------------

Is there a difference between these examples or do I confuse the
concepts? What is the wrong order/way to combine transformations to
use with setMatrix() method?

Moreover, OSG transformations always uses local object reference frame
or not (instead of global origin (0.0.0) )? For ex: when we rotate a
point/object, do we also rotate its local reference frame? In addition
to that, does the second rotation use this rotated reference frame
(after the first rotation)? Ex: rotate() uses local axis (parameter as
Vec3) to rotate around or not?


Cheers,
Deniz
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to