[osg-users] That why I think the osg math is really wrong

Robert Osfield robert.osfield at gmail.com
Tue Nov 13 06:02:32 PST 2007


Hi Richard,

The OSG uses post multiplication, if there are any exceptions to this
then they are bugs, it doesn't mean everything is messed up or OSG
maths is generally wrong.  Is it only Vec3 * Quat is wrong in your
investigations?  Could you add a unit test to the examples/osgunittest
application so we can test for this and qualify and bug fixes to it.

Cheers,
Robert.

On Nov 12, 2007 8:13 AM, Schmidt, Richard, SDGE1
<Richard.Schmidt at eads.com> wrote:
>
>
>
>
> Just test it. The multiplication order is soo messed up.
>
>
>
> Vector3 vs. Matrix = post-multiplication
>
> Vector3 vs. Quat = pre-multiplication
>
> Quat vs. Quat = post-multiplication
>
>
>
> The consequence is that all three lines below give you the same output.
>
>
>
> int main(int argc, char** argv)
>
> {
>
>   osg::Matrix m;
>
>   osg::Matrix m2;
>
>   osg::Quat q( osg::PI_2, osg::Vec3( 0, 0, 1 ) );
>
>   osg::Quat q2( osg::PI_2, osg::Vec3( 0, 1, 0 ) );
>
>   osg::Vec3d t( 2, 0, 0 );
>
>   osg::Vec3d x( 3, 0, 0 );
>
>
>
>   m.setRotate( q );
>
>   m.setTrans( t );
>
>   m2.setRotate( q2 );
>
>
>
>   osg::Vec3d out = x * m * m2;
>
>   osg::Vec3d out2 = q2 * ( q * x + t );
>
>   osg::Vec3d out3 = q * q2 * x + q2 * t;
>
>
>
>
>
>   return 0;
>
> }
>
>
>
> Richard
>
> (PS.: And in GLSL you got Vector4 vs. Matrix = pre-Multiplication …)
>
>
> _______________________________________________
> 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