簡體   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