小编Tol*_*rak的帖子

从2d变换矩阵中提取旋转,缩放值

如何从2d变换矩阵中提取旋转,缩放和平移值?我的意思是有一个2d的转变

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

matrix.rotate(45 / 180 * PI)
matrix.scale(3, 4)
matrix.translate(50, 100)
matrix.rotate(30 / 180 * PI)
matrix.scale(-2, 4)
Run Code Online (Sandbox Code Playgroud)

现在我的矩阵有值[a,b,c,d,tx,ty]

让我们忘记上面的过程,并想象我们只有值a,b,c,d,tx,ty

如何通过a,b,c,d,tx,ty找到总旋转和比例值

对不起我的英语不好

谢谢你的进步

编辑

我认为应该是某个地方的答案......

我刚刚在Flash Builder(AS3)中试过这样的

   var m:Matrix = new Matrix;
   m.rotate(.25 * Math.PI);
   m.scale(4, 5);
   m.translate(100, 50);
   m.rotate(.33 * Math.PI);
   m.scale(-3, 2.5);

   var shape:Shape = new Shape;
   shape.transform.matrix = m;

   trace(shape.x, shape.y, shape.scaleX, shape.scaleY, shape.rotation);
Run Code Online (Sandbox Code Playgroud)

输出是:

x = -23.6 
y = 278.8 
scaleX = 11.627334873920528 
scaleY = -13.54222263865791 
rotation = 65.56274134518259 …
Run Code Online (Sandbox Code Playgroud)

math matrix flash-builder

21
推荐指数
3
解决办法
2万
查看次数

标签 统计

flash-builder ×1

math ×1

matrix ×1