我们如何从变换矩阵中得到x和y? [英] How we get x and y from the transform matrix?
本文介绍了我们如何从变换矩阵中得到x和y?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Possible Duplicate:
How to get the actual x/y position of an element in SVG with transformations and matrices
我需要获取在SVG中这样编写的元素的x/y位置:
I need to get the x/y positions of an element that is written like this in SVG:
<image
y="-421.28461"
x="335.27295"
id="image2991"
xlink:href="file:///C:/Users/tom/Documents/t.jpg"
height="369"
width="360"
transform="matrix(0.22297057,0.97482518,-0.97482518,0.22297057,0,0)" />
此处x
&给出了y
属性,但是没有给出图像的实际位置.据我在
Here x
& y
attributes are given but this not gives the image actual position. As much as i know in the
转换矩阵[a,b,c,d,e,f]
e
& f
分别在x和y中给出平移轴.但是
transform matrix [a,b,c,d,e,f]
e
& f
gives the translated axis in the x and y respectively. But the
问题在于,这两个( e & f )
都为0.现在我可以获取此图像的实际x
任何y
吗?
problem is that here both ( e & f )
are 0. Now i can i get the actual x
any y
for this image?
推荐答案
假设
x="335.27295"
y="-421.28461"
给出变换矩阵
a b e
c d f
0 0 1
具有值
0.22297057 0.97482518 0
-0.97482518 0.22297057 0
0 0 1
知道
- a,d分别负责缩放x,y
- e,f负责分别转换x,y
您最终会得到
newX = x * a + e
newY = y * d + f
或者,
newX = 335.27295 * 0.22297057 + 0 = 74.75
newY = -421.28461 * 0.22297057 + 0 = -93.93
这篇关于我们如何从变换矩阵中得到x和y?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文