gpt4 book ai didi

c# - 如何检索每个轴上的 3D 旋转角度?

转载 作者:太空狗 更新时间:2023-10-29 23:34:43 25 4
gpt4 key购买 nike

我有一个 Model3DGroup,它使用应用于对象的 Transform 属性的 AxisAngleRotation3D 围绕任何 x、y、z 轴旋转。

问题是我无法控制网格上应用的各种旋转。我需要在每个渲染循环中在每个 x、y、z 轴上显示网格的角度。

我该怎么做?我尝试检索对象上的 AxisAngleRotation3D 对象,但它只给我上次应用的旋转。这是不正确的。

例如,如果应用了旋转轴:Vector3D(1, 1, 0)角度:45

实际绕Z轴旋转不会为0。如何获得每个轴上的实际角度?

最佳答案

 double rotationX = Vector3D.AngleBetween(new Vector3D(1, 0, 0), yourMatrix3D.Transform(new Vector3D(1, 0, 0)));
double rotationY = Vector3D.AngleBetween(new Vector3D(0, 1, 0), yourMatrix3D.Transform(new Vector3D(0, 1, 0)));
double rotationZ = Vector3D.AngleBetween(new Vector3D(0, 0, 1), yourMatrix3D.Transform(new Vector3D(0, 0, 1)));

关于c# - 如何检索每个轴上的 3D 旋转角度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4364780/

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