On 1/15/2011 3:43 PM, Rob Radtke wrote:
- Add a transpose() function to Matrixf and Matrixd
Rather than a transpose() function, I wonder if anyone else would be interested
in seeing support for two different operator*() methods to handle vector/matrix
multiply, namely:
osg::Vec4 v;
osg::Matrix m;
vec4 vprime = v * m; // multiply the row vector by the row-major matrix,
// as currently supported by OSG.
vprime = m * v; // effectively multiply the vector by the matrix transpose.
In the second case, each element of vprime would be computed as:
vprime.x = dot( m.column0, v );
vprime.y = dot( m.column1, v );
vprime.z = dot( m.column2, v );
vprime.w = dot( m.column3, v );
Similarly, GLSL uses order to do essentially the same thing, however, GLSL uses
column major matrices (as per OpenGL spec, math texts, etc), so the ordering is
reversed, that is:
vec4 vprime = m * v; // multiply column vector by column-major matrix
vprime = v * m; // effectively multiply the vector by the matrix transpose.
If we were to do this in OSG, it would make it a bit easier to multiply an
instance of the osg::Plane class by a matrix, we could just define an
operator*() for that, like we would do for Vec4.
-Paul
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org