Does open inventor use column vectors to apply matrix multiplications or row vectors?
Announcement
Collapse
No announcement yet.
Matrix and vector multiplication
Collapse
X

Row vectors
Originally posted by zack View PostDoes open inventor use column vectors to apply matrix multiplications or row vectors?
Open Inventor considers coordinates to be row vectors.
Therefore use SbMatrix::multVecMatrix to transform a position (e.g. from object coords to world coords) and SbMatrix::multDirMatrix to transform a normal vector.
Correspondingly transforms are applied "left to right".
So use SbMatrix::multLeft to concatenate a transform onto the cumulative modeling matrix.
Matrices are effectively stored in columnmajor order. So m[i][j] is the value in column i and row j (just like OpenGL matrices, but unlike classic C/C++ 2d arrays). For example, in a 4x4 transform matrix the translation X, Y, Z values are in m[3][0], m[3][1] and m[3][2].
Mike

The OIV doc saith :
4x4 matrix class/datatype used by many Open Inventor node and action classes. The matrices are stored in rowmajor order.
When OIV use row vectors, then I have to use SbMatrix::multRight
to concatenate a new transformation to the current one.
Another question, juse to clear some points:
When I insert a rotation as first child, a translation as second child and a primitive as third child in the scenegraph.
Which transformation is applied first to the primitive?
The inventor mentor said, it would be the translation and then the rotation.
And because of that I though OIV use column vector (V' = R * T * V)
Comment

Trust the source
Originally posted by zack View PostThe OIV doc saith : "The matrices are stored in rowmajor order."
We'll fix that in the next release (i.e. after 8.0). For now see my previous message based on reading the source code.
Another question, juse to clear some points:
When I insert a rotation as first child, a translation as second child and a primitive as third child in the scenegraph. Which transformation is applied first to the primitive?
The inventor mentor said, it would be the translation and then the rotation.
And because of that I though OIV use column vector (V' = R * T * V)
Regards,
Mike
Comment
Comment