Ejemplo n.º 1
0
 /// <summary>
 /// Makes a copy of the source quaternion
 /// </summary>
 public Quaternion( Quaternion src )
 {
     m_X = src.m_X;
     m_Y = src.m_Y;
     m_Z = src.m_Z;
     m_W = src.m_W;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Sets the camera view frame from a quaternion
 /// </summary>
 protected void SetViewFrame( Quaternion orientation )
 {
     Matrix44.MakeQuaternionMatrix( m_InvLocalView, orientation );
     m_LocalView.Copy( m_InvLocalView );
     m_LocalView.Transpose( );
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Makes a matrix from a quaternion
 /// </summary>
 public static void MakeQuaternionMatrix( Matrix44 matrix, Quaternion quaternion )
 {
     MakeQuaternionMatrix( ( InvariantMatrix44 )matrix, quaternion );
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Makes a matrix from a quaternion
 /// </summary>
 public static new Matrix44 MakeQuaternionMatrix( Quaternion quaternion )
 {
     Matrix44 result = new Matrix44( );
     MakeQuaternionMatrix( ( InvariantMatrix44 )result, quaternion );
     return result;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Sets the camera view frame from a quaternion
 /// </summary>
 protected void SetViewFrame( Quaternion orientation )
 {
     //	Matrix44.MakeQuaternionMatrix( m_InvLocalView, orientation );
     //	m_LocalView = m_InvLocalView.Transpose( );
     Matrix44.MakeQuaternionMatrix( m_LocalView, orientation );
     m_InvLocalView.StoreInverse( m_LocalView );
 }
 /// <summary>
 /// Changes the camera yaw 
 /// </summary>
 public void ChangeYaw( float radians )
 {
     m_Orientation = m_Orientation * Quaternion.FromAxisAngle( Vector3.YAxis, radians );
 }
 /// <summary>
 /// Changes the camera roll 
 /// </summary>
 public void ChangeRoll( float radians )
 {
     m_Orientation = Quaternion.FromAxisAngle( Vector3.ZAxis, radians ) * m_Orientation;
 }
        /// <summary>
        /// Stores a quaternion in the specified matrix
        /// </summary>
        protected static void MakeQuaternionMatrix( InvariantMatrix44 matrix, Quaternion quaternion )
        {
            float fTx = 2.0f * quaternion.X;
            float fTy = 2.0f * quaternion.Y;
            float fTz = 2.0f * quaternion.Z;
            float fTwx = fTx * quaternion.W;
            float fTwy = fTy * quaternion.W;
            float fTwz = fTz * quaternion.W;
            float fTxx = fTx * quaternion.X;
            float fTxy = fTy * quaternion.X;
            float fTxz = fTz * quaternion.X;
            float fTyy = fTy * quaternion.Y;
            float fTyz = fTz * quaternion.Y;
            float fTzz = fTz * quaternion.Z;

            float[] elements = matrix.m_Elements;

            elements[ 0 ] = 1.0f - ( fTyy + fTzz );
            elements[ 1 ] = fTxy - fTwz;
            elements[ 2 ] = fTxz + fTwy;

            elements[ 4 ] = fTxy + fTwz;
            elements[ 5 ] = 1.0f - ( fTxx + fTzz );
            elements[ 6 ] = fTyz - fTwx;

            elements[ 8 ] = fTxz - fTwy;
            elements[ 9 ] = fTyz + fTwx;
            elements[ 10 ] = 1.0f - ( fTxx + fTyy );
        }
 /// <summary>
 /// Makes a matrix from a quaternion
 /// </summary>
 public static InvariantMatrix44 MakeQuaternionMatrix( Quaternion quaternion )
 {
     InvariantMatrix44 result = new InvariantMatrix44( );
     MakeQuaternionMatrix( result, quaternion );
     return result;
 }