[osg-users] Correction of wikipage Support/Maths/MatrixTransformations
Robert Osfield
robert.osfield at gmail.com
Thu Sep 4 02:20:14 PDT 2008
Hi Matthias,
I've just quickly gone through the page you mention and it looks fine.
As for what convention people use - well it all depends on what your
background is, as to whether you view a vector as a column or a row,
as also the pre/post multiplication. With the osg vectors are a row,
and the matrices are row major - consistent with how data is actually
stored in OpenGL and OSG.
Robert.
On Wed, Sep 3, 2008 at 7:19 PM, Matthias Bindernagel
<matthias.bindernagel at gmx.de> wrote:
> Hello,
>
> on the page
> http://www.openscenegraph.org/projects/osg/wiki/Support/Maths/MatrixTransformations
> is stated that one should
>
>>pass this matrix
>>
>>GLfloat ZrotateMatrix[][4] = {
>> { cosA, -sinA, 0, 0 },
>> { sinA, cosA, 0, 0 },
>> { 0, 0, 1, 0 },
>> { 0, 0, 0, 1 }
>>};
>>
>>to glLoadMatrixf(): and see what happens (g'ahead try it, don't take my word
> for it).
>>Your rotations will be the opposite of what you expect.
>
> Well, the correctness of the result depends on what you expect: OpenGL's
> glLoadMatrixf() and its variants expect a column-major-matrix as parameter
> (see http://www.opengl.org/sdk/docs/man/xhtml/glLoadMatrix.xml); passing a
> row-major-matrix (like done in this example) to glLoadMatrixf() results in a
> transformation described by the transposed matrix-argument. Same holds true
> for the translation described later on the wiki page.
>
> So the results of the allegedly erroneous examples are actually correct,
> regarding the OpenGL documentation and standard maths.
>
>
> Another point I want to mention here is my surprise about the argumentation of
> the matrix-vector-product in OSG:
> Almost every book or website I've read about computer graphics in general and
> some DSL's in particular uses
> V' = M * V
> on a broad basis, where V' is the transformed vector, V is the original vector
> and M descibes the trafo.
>
> One could - like the documentation did - replace this commonly used matrix
> product with W' = W * N, but (at least in my opinion) _must_ mention that:
> 1. W' and W are transposed vectors (that is, they are row vectors, instead of
> widely used column vectors)
> 2. N must not be a common transformation matrix (like the ones mentioned on
> wikipedia or mathworld.wolfram.com), but the transpose of such a matrix.
>
>
> IMHO, the documentation found on that wiki page does need some slight
> corrections, but also a lot of additions to clearly state when to use
> original or transposed transformation matrices.
>
> Regards, Matthias Bindernagel
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
More information about the osg-users
mailing list