Jump to content
  • Advertisement
Sign in to follow this  

A question regarding polar decomposition

This topic is 2348 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, this is my first post here, I hope not the last, and I have a problem regarding polar decomposition.
I understand how it works and that it can compute the rotation and scale, and I am aware that these are the rotation and the scale that are the best guess of the algorithm and I'm cool with it.
But when I try to calculate a scale matrix from a matrix M, that has a lot of transformations stored in it, like, a lots of rotations, scales and shears, and God knows in what order are those applied, I can't get the matrix that looks like a scale matrix or even reminds of it. I can get the rotation matrix, for which I know that it is not the original rotation, but the "guessed" rotation.

Let me give you an example:
I have a rotation, scale and a shear (skew) matrices:

R = [ 0.86603 -0.5; 0.5 0.86603 ]
Scale = [ 2 0; 0 3 ]
Shear = [ 1 0.3; 0.6 1 ]

And if I apply them like this:

M = Shear * Scale * R

and run the left polar decomposition on the matrix M that calculates M = Scale * Rotation i get these results:

Rotation = [ 0.80028 -0.59962; 0.59962 0.80028 ] I checked, and this is rotation matrix
Scale = [ 1.8785 1.1319; 1.1319 3.1573 ]

and if I run the right polar decomposition I get these results:

Rotation = [ 0.80028 -0.59962; 0.59962 0.80028 ]
Scale = [ 3.42462 0.93162; 0.93162 1.61125 ]

As you can see none of those Scale matrices from left or right polar decomposition is a real scale matrix or even close to one.
Is that because the shear transformation is applied, or is it something else that I am missing?
I would really appreciate if someone could shine some light for me on this one.

Note: I computed these matrices using Octave and my own implemetation of the polar decomposition algorithm just to be safe that the results are valid.
Best regards! Edited by pivonroll

Share this post

Link to post
Share on other sites
OK, I found out that in case of the polar decomposition where M = Rotation * S, matrix S can be thought of as the matrix that is the result of Scale * Shear ( S = Scale * Shear ). This is true if matrix S is not diagonal matrix, or in other words if S is not a scale matrix.
Decomposition of matrix S to matrices Scale and Shear can be done using this algorithm:

If matrix S can be presented as:

s11 s12
s21 s22

then scale matrix is:

s11 0
0 s22

and shear matrix is:

1 s12/s11
s21/s22 1

So matrix M can be presented as M = Rotation * Scale * Shear.
You can see that I have used the right polar decomposition for this solution. Edited by pivonroll

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!