Hi Nirnimesh, On 6/22/06, Nirnimesh <[EMAIL PROTECTED]> wrote:
I have a few probs with using osg::Matrix.1. The inverse function seems to be wrong. For instance, osg::Matrix mat(0.998993,0.0448774,0,865.829, 5.2337e-07,-1.16505e-05,1,-158.014, 0.0448774,-0.998993,-1.16622e-05,-2812.84, 0,0,0,1); cout << Matrix::inverse(mat) << endl; This _does_not_ give the correct inverse (I've verified with Matlab). However, mat.inverse_4x4_orig(mat) gives it correct.
The above matrix is column major rather than row major, and the invert method was calling the invert method optimized for column row major (that what the OSG convention is), hence the error.
2. What's the diff between matrix_4x4_new() and matrix_4x4_orig (in class osg::Matrix)? Matrix::inverse() makes use of matrix_4x4_new -- the wrong one.
This morning I checked in a new Matrix*::invert(Matrix&) version that checks the right hand column is 0,0,0,1 before calling the invert_4x4_new method, otherwise falling back to invert_4x4_orig. This should solve the problem you have encountered. I have also renamed the invert_4x4_new method invert_4x3 and invert_4x4_orig method invert_4x4 so make their roles clearer. FYI, the invert_4x4_new and the invert_4x4_orig owe there names to the testing done on the two methods when I original merged the newer and faster invert method. I left the original one in place in case of problems... which was kinda fortiotous in this case ;-) I have also add a test into osgunittests to confirm that the new checks in Matrix*::invert() work fine on full 4x4 matrices now. These obviously hasn't made it into 1.1, but they will be part of the up coming 1.1.1 maintaince release.
3. Why doesn't osg::Matrix have a transpose function?
To discourgage its use :-) One can always convert a post multiplication into post multiplication to do an effective transpose, and this has zero overhead. _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
