[osg-users] Matrix decompose and non-uniform scaling

Riccardo Corsi riccardo.corsi at vrmmp.it
Wed Mar 11 04:36:49 PDT 2009

Hi All,

there have been no replies to this thread,
but I have found exactly the same problem here.
In particular it appears only when scale components "x" and "y" are 
equivalent, and (on our boxes, running WinXP) only in release compiled 
code - the debug version works correctly!!

I don't know the theory of how to apply the scale orientation in the 
correct way either, but heuristically I've found that, if you build a 
rotation matrix from the quaternion, and you ignore its signs, you can 
find the original scale vector by multiplying:

// scaleOrientMat.set(scaleOrientQuat)
origScaleVec = decompScaleVec * ABS( scaleOrientMatrix)

Is this something expected or there's a bug somewhere?


On 01/02/2009 20.26, Östen wrote:
> I have a problem with the decompose method of osg::Matrix in 
> combination with non-uniform scaling.  I create a matrix with 
> osg::matrix::scale(100, 100, 1) and even though the matrix seems 
> correct (100, 0, 0, 0, 0, 100, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)  the 
> decompose method returns a scale = (100, 1, 100) and a scale 
> orientation of (0.707, 0, 0, 0.707). I have tried to apply the scale 
> orientation transform to the scale but there is no way i can get it 
> back to (100, 100, 1).
> Also if one component of the scale is negative decompose will return 
> negative values for all components.
> How is this supposed to work? Is it a bug or am I making some 
> incorrect assumtions here?
> Östen Lundahl
> ------------------------------------------------------------------------
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090311/533a9331/attachment-0002.htm>

More information about the osg-users mailing list