View Full Version : SVD decomposition when using rotation and scaling pivots?

25th May 2006, 17:15

This isn't really a C++ question, but I give it a shot.

In my 3d scene I have a object A which inherits transformations from its parent B. A is rotated around a scaling pivot and scale around a scaling pivot.

Now I want to break the connection between A and B so A has no parent. But I want A have the same transformation sum. So I need to express transformation matrix M into Translation Rotation and scaling. M is the accumluated transformations from B and A.

Many people use SVD for this. But I cant find anywhere how the pivot points affect the result. They are baked in the matrix M... but how does this affect the result?

Do you know any good papers or tutorials about this? That is, transformation decomposition when M contains pivot point translations?


25th May 2006, 17:32
I've read your post twice, but I'm still not sure what you mean. You say it has nothing to do with C++, but you speak of objects. What exactly do these objects do?

If it's not about C++, is it about linear algebra?

Please be more specific.

25th May 2006, 17:39

Sorry about begin so abstract. It's just that I've been searching the net all day for papers about this... and it makes me a bit cRaZy.

Yes, it's linear algebra. It is not c++. It is more of a computer 3d graphics question. But since Qt has openGL support I'm hoping that there are some graphics people here who can give me a hint about where to look for answers. The reason why I used the word object has nothing to do with the language, it was more of an expression to describe the components of my 3d scene.

This is my question more exact.

component A is transformed by matrix Ma. Ma is created by multiplication of a translation, a rotation and a scaling. The rotation and scaling are performed in different pivot points.

component B is a parent of component A and has transformation matrix Mb.

A inherits transformations from B. So Mb is contained in Ma.

What I want to do is to make A an orphin. So it doesn't inherit the transformations from B anymore. But I still want A to have the same transformation matrix Ma. But now I need to change the definition of Ma, that is the translation, scaling and rotation. But I don't want to change the scaling and rotation pivots. So I am not sure how this affect the result of using Singular Value Decomposition, SVD. I suppose the pivot points translations are baked into the svd answer, and that isn't so good...

hoping on a hint...

25th May 2006, 18:02
Let me try to see what you're trying to do. You have a matrix M that contains an arbitrary combination of rotations, scalings and translations. You want to decompose it and recover the pivot points, because you want to store them seperately?

I think that's either not possible (since there are many possible decompositions) or more trouble than it's worth. Mind you, it's been a while since I calculated SVD's or eigenvalues, so I might be off base (I should catch up).

If A works the way you want it when it inherits from B, but you do not want to inherit from B any longer, can't you copy the member variables and functions from B over to A, giving A the exact same functionality? This might sound a bit simplified, but you know what I mean.

Alternatively (and I'm really not sure how much this will help, because I'm still not sure what your problem is), don't store matrix M, but store the decomposed version from the beginning. For the moment don't worry about performance, since decomposing M to get what you want can't be all that efficient either.

I hope that helps a little.

25th May 2006, 18:09

I have the pivot points and the separate tansRotScale which are used at the beginning. But I need to update the translation rotation and scaling so they work in world space. And if it's worth the trouble is more of a question about what the program is about. The program must be able to produce this data. So it's worth it.

I know that there are no unique solution to the decomposition of the transformation matrix. That is not a problem. The only constraints I have is that it produces the same transformations and it uses the pivot points of A.

I don't think that the naive approach is valid. That is to add B's translation to A's translation and so forth.


25th May 2006, 18:21
So originally, B did some transformations and A did some. Now you want to store both in one class. No, you can't simply add the translation of B to those of A. Since matrix multiplication isn't commutative, you have to retain the order of the transformations. So can't you simply store an array/vector/list of matrices?

25th May 2006, 18:24
no, I need one translation, one rotation and one scaling.

25th May 2006, 18:45
We're homing in on your actual question. :)

So originally both A and B contributed some transformation matrices (let's say C, D, E, F, G and H). Multiplied in the correct order they form matrix M and you want to decompose that into one translation, one scaling and one rotation (I, J and K). So:


If you can obtain these using SVD you will get a result with the original pivot points baked in, yes. I don't think it's possible to retrieve them, since both B and A contributed transformations. By combining them into M you lost information. What effect does it have on the result? Well, if you apply IJK to a 3D vector it will have the exact same result as applying M or CDEFGH.

25th May 2006, 18:54
Well, that is what I'm not sure of. So what you're saying is that they would automaticly rotate and scale around the pivot points? I'm not really sure of that. That is why I need to see some papers about the subject.

25th May 2006, 19:06
I am sure. If the original matrices (CDEFGH) did the correct translations from and to the pivot points, then they will be retained after the multiplication and decomposition. Of course, you won't see all seperate original transformations happen, but the end result will be the same.

If you can say something like: CDEFGH = M (which is valid after matrix multiplications) then wherever you can use CDEFGH (like to transform a vector), you can also use M with the same result. This is done often in computer graphics.

Similarly, if you can say: M = IJK, then anywhere you can use M, you can use IJK with the same result. Like I said, it's been a while since I used singular value decomposition, so I'm not exactly sure you can get your three matrices that way. But if you can, you can be sure that the resulting three matrices have the same effect as the original M.

Why don't you try wikipedia (http://en.wikipedia.org/wiki/Matrix_theory)?

25th May 2006, 19:30
Ok, but SVG is used to get the scaling and rotation. The translation isn't calculated. It is already ready in one of the colmns.

This means that I suppose that the translation is made in the origo of the coordinate space. I suppose that I can just compute the transformation comlumn for the scaling and roation matrixes which are made because of the pivot points. Then I can subtract these from the new translation.

But I really want to be sure about this. The program is supposed to be used by scientists. It really would be nice to read about this somewere else. Because I feel a bit rusty and I would like to be 110% sure.


25th May 2006, 19:38
Translation is the only transformation that uses the fourth column. I don't think you need to think in terms of pivot points. That's all been done already. If you've got M and two of I,J,K, you can find the translation-matrix easily.

If wikipedia isn't enough, I can't really help you further. You might try google, but you've probably already tried that.

Good luck!

25th May 2006, 21:12
If I don't use the pivots points after the SVD, then I loose controll of their functionality. I also need to think of this when I set up the local space after SVD. Because it would be done twice. But it doesn't matter. I have thought about it, and I'm pretty sure that the pivot point information does not concern the SVD step. That is stored in the translation column. I just think it's strange that I can't find any websites that doing this.

Thanks for your help.

Is there any one else who knows a tutorial or paper about this?
That is, how to use SVD when there are pivot points in the transformation matrix?
( what I'm really after is the step that I think does not involve SVD, the translation )