如何获取每个轴上的3D旋转角度? [英] How to retrieve the 3D rotation angle on each axis?
问题描述
我有一个Model3DGroup,它使用应用于对象的Transform属性的AxisAngleRotation3D绕x,y,z轴中的任何一个旋转.
I have a Model3DGroup which is rotated around any of the x, y, z axis using an AxisAngleRotation3D applied on the Transform property of the object.
问题是我无法控制施加在网格上的各种旋转.我需要在每个渲染循环的x,y,z轴上分别显示网格的角度.
The problem is that I am not in control of the various rotations applied on the mesh. I need to display the angle of the mesh on each of the x, y, z axis at each render loop.
我该怎么做?我尝试检索该对象上的AxisAngleRotation3D对象,但它只为我提供了上一次应用的旋转.哪个不正确.
How can I do that? I tried retrieving the AxisAngleRotation3D object on the object, but it only gives me the rotation that was last applied. Which is not correct.
例如,如果应用了轮换轴:Vector3D(1,1,0)角度:45
If for example there was an applied rotation of Axis: Vector3D(1, 1, 0) Angle: 45
围绕Z轴的实际旋转将不为0.如何获得每个轴上的实际角度?
The actual rotation around Z axis would not be 0. How can I get the actual angle on each axis?
推荐答案
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)));
这篇关于如何获取每个轴上的3D旋转角度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!