More info -- This is not an issue. "m * v" is equivalent to "v * mTranspose".
I had previously written code that indicated this was broke for vectors, but I
recently rewrote the test case:
{
osg::Vec4 v( 1.0, 0.0, 0.0, 1.0 );
osg::Matrix m( osg::Matrix::translate( 3., 5., 0. ) );
osg::Plane p( v );
p.transform( m ); // multiply by inverse transpose
osg::notify( osg::NOTICE ) << p << std::endl;
osg::Matrix mInv = osg::Matrix::inverse( m );
osg::Vec4 vPrime = mInv * v; // multiply by inverse transpose
osg::notify( osg::NOTICE ) << vPrime << std::endl;
}
and I am now getting the same results for both the Plane and the Vec4 transform.
So my original code must have been flawed.
Back to the original poster, then... Does this eliminate a need for a
transpose() function in the Matrix class?
-Paul
On 1/16/2011 10:10 AM, Jean-Sébastien Guay wrote:
Hi Paul,
Well, this doesn't appear to work for Plane:
I wouldn't know about planes, I've only ever used the multiply by transpose to
transform direction vectors or normals, never planes. Perhaps there's just a
little extra needed (for example, maybe adding an implicit conversion
constructor from osg::Vec4 to osg::Plane or an additional Plane
operator*(Matrix, Plane) method.
It's just that I had seen that page about the V*M and M*V a long time ago, and
thought it would be good to know there's already part of the work done.
Converting the plane to a Vec4 allows me to do this:
osg::Vec4 pv = p.asVec4();
osg::Vec4 pvprime = l2w * pv;
That code compiles and runs, but produces incorrect results when
compared to the (correct) results of osg::Plane::transform().
Did you look at the math that this results in? Running it in the debugger would
likely tell you why it doesn't work. Again I'm not much help, I've never done
this myself.
Sorry I can't help more,
J-S
--
-Paul Martz Skew Matrix Software
http://www.skew-matrix.com/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org