extract rotation, scale values from 2d transformation matrix

后端 未结 4 1999
野性不改
野性不改 2020-11-30 20:24

how can i extract rotation, scale and translation values from 2d transformation matrix? i mean a have a 2d transformation

matrix = [1, 0, 0, 1, 0, 0]

matri         


        
4条回答
  •  时光取名叫无心
    2020-11-30 21:04

    If in scaling you'd scaled by the same amount in x and in y, then the determinant of the matrix, i.e. ad-bc, which tells you the area multiplier would tell you the linear change of scale too - it would be the square root of the determinant. atan( b/a ) or better atan2( b,a ) would tell you the total angle you have rotated through.

    However, as your scaling isn't uniform, there is usually not going to be a way to condense your series of rotations and scaling to a single rotation followed by a single non-uniform scaling in x and y.

提交回复
热议问题