當前位置: 首頁>>代碼示例>>C#>>正文


C# Quaternion.Normalize方法代碼示例

本文整理匯總了C#中OpenMetaverse.Quaternion.Normalize方法的典型用法代碼示例。如果您正苦於以下問題:C# Quaternion.Normalize方法的具體用法?C# Quaternion.Normalize怎麽用?C# Quaternion.Normalize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenMetaverse.Quaternion的用法示例。


在下文中一共展示了Quaternion.Normalize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: rotate

 /// <summary>
 /// rotate the specified amounts around the camera's local axis
 /// </summary>
 /// <param name="X"></param>
 /// <param name="Y"></param>
 /// <param name="Z"></param>
 public void rotate(float X, float Y, float Z)
 {
     if (YawFixed) {
         // some of the rotation is around X
         OMV.Quaternion xvec = OMV.Quaternion.CreateFromAxisAngle(OMV.Vector3.UnitX, X);
         xvec.Normalize();
         // some of the rotation is around Z
         OMV.Quaternion zvec = OMV.Quaternion.CreateFromAxisAngle(OMV.Vector3.UnitZ, Z);
         zvec.Normalize();
         m_heading = zvec * m_heading;
         m_heading = m_heading * xvec;
     }
     else {
         OMV.Quaternion rot = new OMV.Quaternion(X, Y, Z);
         rot.Normalize();
         rotate(rot);
     }
 }
開發者ID:Misterblue,項目名稱:LookingGlass-Viewer,代碼行數:24,代碼來源:EntityCamera.cs

示例2: rotate

 /// <summary>
 /// rotate the specified amounts around the camera's local axis
 /// </summary>
 /// <param name="X"></param>
 /// <param name="Y"></param>
 /// <param name="Z"></param>
 public void rotate(float X, float Y, float Z)
 {
     if (YawFixed) {
     // some of the rotation is around local X
     OMV.Quaternion xvec = OMV.Quaternion.CreateFromAxisAngle(OMV.Vector3.UnitY, -X);
     // some of the rotation is around Z
     OMV.Quaternion zvec = OMV.Quaternion.CreateFromAxisAngle(OMV.Vector3.UnitZ, Z);
     // m_heading = m_heading * xvec;
     m_heading = xvec * m_heading * zvec;
     // LogManager.Log.Log(LogLevel.DVIEWDETAIL, "CameraControl.rotate: xv={0}, zv={1}, h={2}",
     //                     xvec, zvec, m_heading);
     }
     else {
     OMV.Quaternion rot = new OMV.Quaternion(X, Y, Z);
     rot.Normalize();
     rotate(rot);
     }
     if (OnCameraUpdate != null) OnCameraUpdate(this);
 }
開發者ID:Misterblue,項目名稱:LookingGlass-Viewer,代碼行數:25,代碼來源:CameraControl.cs


注:本文中的OpenMetaverse.Quaternion.Normalize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。