gpt4 book ai didi

wpf - 在 XAML 中从菱形的偏斜因子创建偏斜 AngleY

转载 作者:行者123 更新时间:2023-12-02 00:39:22 27 4
gpt4 key购买 nike

我不确定这是否可行,但基本上我有两个度数可以改变图像的宽度/大小和倾斜度。在转换矩阵 ( <Matrix3DProjection/> ) 中,它是这样工作的:

M11:cos(x)   M12:sin(y)*sin(x)   M11:0M21:0        M22:cos(y)          M23:0M31:0        M32:0               M33:1 

所以如果我有 X = 30°Y=40° ,我的矩阵是:

M11:0.866    M12:0.321           M11:0M21:0        M22:0.766           M23:0M31:0        M32:0               M33:1 

所以 normal变成 30x40

我想改用 <TransformGroup/>但不太明白 <SkewTransform AngleY="???"/>部分。 <ScaleTransform/>ScaleX 中使用上面的 M11M22 值似乎很容易和 ScaleY喜欢<ScaleTransform ScaleX=".866" ScaleY=".766"/> .

但我无法弄清楚 AngleY <SkewTransform/>的一部分来自 M12 0.321 的值。我知道通过手动处理这个,值 AngleY="20.3"似乎很准确。但我无法弄清楚这背后的数学原理。

有人知道吗?

最佳答案

您可以在 SkewTransform 类上使用 Reflector 来找出数学。它调用Matrix.Skew ,它使用矩阵:

1.0           tan(skewY)    0.0
tax(skewX) 1.0 0.0

因为您想要 tan(skewY) * 0.766 = 0.321,所以您得到 skewY = atan(0.321/0.766) = 22.7366108 度。或者,回到您的原始数字,skewY = atan(sin(y) * sin(x)/cos(y)) = atan(tan(y) * sin(x)),其中产生 atan(tan(40 degrees) * sin(30 degrees)) = 22.7604763 degrees

关于wpf - 在 XAML 中从菱形的偏斜因子创建偏斜 AngleY,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3226116/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com