Exemplo n.º 1
0
 public Pose()
 {
     Position = Position.Zero;
     Orientation = Quaternion.Identity;
 }
Exemplo n.º 2
0
        public static Matrix4 FromQuaternion(Quaternion quat)
        {
            float tx  = 2.0f * quat.X;
            float ty  = 2.0f * quat.Y;
            float tz  = 2.0f * quat.Z;
            float twx = tx * quat.W;
            float twy = ty * quat.W;
            float twz = tz * quat.W;
            float txx = tx * quat.X;
            float txy = ty * quat.X;
            float txz = tz * quat.X;
            float tyy = ty * quat.Y;
            float tyz = tz * quat.Y;
            float tzz = tz * quat.Z;

            Matrix4 result;
            result.M00 = 1.0f - (tyy + tzz);
            result.M01 = txy - twz;
            result.M02 = txz + twy;
            result.M03 = 0.0f;
            result.M10 = txy + twz;
            result.M11 = 1.0f - (txx + tzz);
            result.M12 = tyz - twx;
            result.M13 = 0.0f;
            result.M20 = txz - twy;
            result.M21 = tyz + twx;
            result.M22 = 1.0f - (txx + tyy);
            result.M23 = 0.0f;
            result.M30 = 0.0f;
            result.M31 = 0.0f;
            result.M32 = 0.0f;
            result.M33 = 1.0f;
            return result;
        }