繁体   English   中英

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

[英]How to retrieve the 3D rotation angle on each axis?

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

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

我怎样才能做到这一点? 我尝试在对象上检索AxisAngleRotation3D对象,但它只给出了上次应用的旋转。 哪个不对。

例如,如果应用了Axis的旋转: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)));

Model3DGroup.Transform.Value属性是表示完整转换的Matrix3D。 http://msdn.microsoft.com/en-us/library/system.windows.media.media3d.matrix3d.aspx

矩阵的元素代表完整的变换。 从矩阵形式到旋转角度(欧拉角度)的转换非常简单。 参见例如http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToEuler/index.htm

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM