I have a series of points in two 3D systems. With them, I use np.linalg.lstsq to calculate the affine transformation matrix (4x4) between both. However, due to my project, I have to "disable" the shear in the transform. Is there a way to decompose the matrix into the base transformations? I have found out how to do so for Translation and Scaling but I don't know how to separate Rotation and Shear. If not, is there a way to calculate a transformation matrix from the points that doesn't include shear? I can only use numpy or tensorflow to solve this problem btw.
Asked
Active
Viewed 2,255 times
1
-
This looks more like a continuum mechanics question than a programming one. – Daniel F Aug 16 '18 at 12:18
-
Do you have to use numpy or tensorflow for this? Sometimes it's easier just to do the maths yourself, and ultimately probably going to serve you better in the long run. https://math.stackexchange.com/questions/612006/decomposing-an-affine-transformation – AdaRaider Aug 16 '18 at 12:28
1 Answers
1
I'm not sure I understand what you're asking.
Anyway If you have two sets of 3D points P and Q, you can use Kabsch algorithm to find out a rotation matrix R and a translation vector T such that the sum of square distances between (RP+T) and Q is minimized. You can of course combine R and T into a 4x4 matrix (of rotation and translation only. without shear or scale).

David
- 481
- 3
- 13
-
Thanks for the reply. What I need is to be able to find the closest transformation from P to Q using only translation, rotation and scaling, i.e. no shear. I need to calculate a similarity transform matrix from the points – Felipe Moser Aug 16 '18 at 12:25
-
You can look here: https://stackoverflow.com/questions/13432805/finding-translation-and-scale-on-two-sets-of-points-to-get-least-square-error-in They explain how to extend the Kabsch algorithm to include scaling as well. In any case, there's no shear in the final transformation matrix. – David Aug 16 '18 at 12:35
-
Thanks for this David! I found a python translation of that paper here: https://gist.github.com/CarloNicolini/7118015 – Felipe Moser Aug 16 '18 at 13:30
-