示例#1
0
        public static void QuaternionAngles(SourceQuaternion q, ref SourceRadianEuler angles)
        {
            // FIXME: doing it this way calculates too much data, needs to do an optimized version...
            SourceMatrix3x4 matrix = new SourceMatrix3x4();

            QuaternionMatrix(q, ref matrix);
            MatrixAngles(matrix, ref angles);
        }
示例#2
0
        public SourceQuaternion(SourceRadianEuler angle)
        {
            var t = new SourceQuaternion();

            MathUtils.AngleQuaternion(angle, ref t);
            this.x = t.x;
            this.y = t.y;
            this.z = t.z;
            this.w = t.w;
        }
示例#3
0
        public SourceQuaternion(SourceDegreeEuler angle)
        {
            SourceRadianEuler radians = new SourceRadianEuler(angle);
            var t = new SourceQuaternion();

            MathUtils.AngleQuaternion(radians, ref t);
            this.x = t.x;
            this.y = t.y;
            this.z = t.z;
            this.w = t.w;
        }
示例#4
0
 public static void MatrixAngles(SourceMatrix3x4 matrix, ref SourceRadianEuler angles)
 {
     float[] a = new float[3];
     for (int i = 0; i < 3; i++)
     {
         a[i] = angles[i];
     }
     MatrixAngles(matrix, ref a);
     for (int i = 0; i < 3; i++)
     {
         angles[i] = a[i];
     }
 }
示例#5
0
        public static void AngleQuaternion(SourceRadianEuler angles, ref SourceQuaternion outQuat)
        {
            float sr, sp, sy, cr, cp, cy;

            SinCos(angles.z * 0.5f, out sy, out cy);
            SinCos(angles.y * 0.5f, out sp, out cp);
            SinCos(angles.x * 0.5f, out sr, out cr);

            // NJS: for some reason VC6 wasn't recognizing the common subexpressions:
            float srXcp = sr * cp, crXsp = cr * sp;

            outQuat.x = srXcp * cy - crXsp * sy; // X
            outQuat.y = crXsp * cy + srXcp * sy; // Y

            float crXcp = cr * cp, srXsp = sr * sp;

            outQuat.z = crXcp * sy - srXsp * cy; // Z
            outQuat.w = crXcp * cy + srXsp * sy; // W (real component)
        }
示例#6
0
        public static void AngleMatrix(SourceRadianEuler angles, ref SourceMatrix3x4 matrix)
        {
            SourceQAngle quakeEuler = new SourceQAngle(RAD2DEG(angles.y), RAD2DEG(angles.z), RAD2DEG(angles.x));

            AngleMatrix(quakeEuler, ref matrix);
        }
示例#7
0
 public static void AngleMatrix(SourceRadianEuler angles, SourceVector position, ref SourceMatrix3x4 matrix)
 {
     AngleMatrix(angles, ref matrix);
     MatrixSetColumn(position, 3, ref matrix);
 }
 public SourceDegreeEuler(SourceRadianEuler angles)
 {
     Init(MathUtils.RAD2DEG(angles.x), MathUtils.RAD2DEG(angles.y), MathUtils.RAD2DEG(angles.z));
 }
        public SourceDegreeEuler(SourceQuaternion q)
        {
            SourceRadianEuler radians = new SourceRadianEuler(q);

            Init(MathUtils.RAD2DEG(radians.x), MathUtils.RAD2DEG(radians.y), MathUtils.RAD2DEG(radians.z));
        }