【发布时间】:2011-05-20 15:52:22
【问题描述】:
如何从二维变换矩阵中提取旋转、缩放和平移值?我的意思是有一个二维变换
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)
现在我的矩阵有值 [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);
输出是:
x = -23.6
y = 278.8
scaleX = 11.627334873920528
scaleY = -13.54222263865791
rotation = 65.56274134518259 (in degrees)
【问题讨论】:
-
这个问题最适合math.stackexchange.com - 你会得到更快的回复:-)
-
我刚刚在这里:math.stackexchange.com/questions/13150/… 谢谢
-
给我们一个例子 a,b,c,d,tx,ty 值,让我们看看是否有任何答案符合您的期望。
-
(a=4.810188218418486, b=10.58569820374103, c=13.4489075059838, d=-1.5870322791938274, tx=-23.601120674381982, ty=2728)
标签: math matrix flash-builder