Hi Paul,

Paul Martz wrote:
> Hi folks -- I've noticed that, under some circumstances, 
> Matrix::getRotate() returns a non-normalized Quat. For example, given 
> the following code:
>  
>     osg::Matrix m( +0.00057735, +0.00000000, +0.00000000, +0.00000000,
>         +0.00000000, +0.00057735, +0.00000000, +0.00000000,
>         +0.00000000, +0.00000000, +0.00057735, +0.00000000,
>         -0.57735026, +1.42264974, -0.57735026, +1.00000000 ) ;
>     std::cout << m.getRotate() ;
>  
> I get this output:
>     0.000000 0.000000 0.000000 0.500433
>  
> This seems odd because, given the same source 
> Matrix, Matrix::decompose() returns a normalized rotation Quat (0, 0, 0, 
> 1). Given that both Quats represent a rotation from the same Matrix, I'd 
> expect them to be identical. (Mathematically, they are identical, except 
> the getRotate() return value isn't normalized.)
>  
> Is this a bug that needs to be fixed?
I'm not sure if it should be called a bug or missing feature :/

AFAIK, the current getRotate code does not handle cases where the matrix 
itself is scaled.

At some point I made modifications to getRotate to first unscale the 
matrix, but:
1) It makes it slower for all the "normal" unscaled cases
2) There were other gotchas (e.g. non-uniform scaling and reflection)
I did not find a suitable solution. I've never tried decompose, maybe 
that is the answer.

If you look at the code in osgunittests that exercises the getRotate 
method, I think you'll find some code in there that can test for the 
scaled matrix case.

regards
jp

>  
> Paul Martz
> *Skew Matrix Software LLC*
> http://www.skew-matrix.com <http://www.skew-matrix.com/>
> 303 859 9466
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail 
legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at 
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their 
support.

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to