P
P
Pavel K2015-09-22 11:40:02
C++ / C#
Pavel K, 2015-09-22 11:40:02

How to parse the transformation matrix into components?

Greetings!
There is a 3x3 matrix, it only has rotation and movement ,
how to disassemble it into its components?
those. get back the angle of rotation and how much moved?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mercury13, 2015-09-22
@PavelK

As I understand it, your 3x3 matrix is ​​\u200b\u200bhomogeneous coordinates in 2D? I would do so.
1. Make sure that the elements 3-1 and 3-2 are zero (otherwise, this is not an affine transformation).
2. Turn element 3-3 into a unit, respectively increasing the rest (by what - read what homogeneous coordinates are).
3. Elements 1-3 and 2-3 - transfer. We cut them off, we get a 2 × 2 matrix.
4. What is left should be of the form (c, s), (-s, c). If this is not the case with some error and the 2-norm of the rows is not one (also with some error), then this is not a rotation (i.e., there may be scaling or skew). It remains to take atan2(c, s) - we get an angle.

A
Antony, 2015-09-22
@RiseOfDeath

0_o
Of course, I have little idea about 3D graphics, but in affine transformations, the matrix seems to be 4x4 / (although, in theory, for 2D, you can throw out the third row and third column from the matrix)
Here is a good article, everything is chewed:
compgraph.tpu.ru/3d .htm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question