Exemplo n.º 1
0
        public void SetPitchYaw(float pitch, float yaw)
        {
            Math.Quaternion yawq = Math.Quaternion.FromAxis(Math.Vector3.Up, yaw);

            Math.Quaternion pitchq = Math.Quaternion.FromAxis(Math.Vector3.Left, pitch);
            _orientation = yawq * pitchq;
        }
Exemplo n.º 2
0
        public void AdjustPitch(float radians)
        {
            const float maxPitch = (float)System.Math.PI * 0.49f;
            const float minPitch = (float)System.Math.PI * -0.49f;

            //Math.Vector3 right = _orientation * Math.Vector3.Right;

            Math.Quaternion rotation = Math.Quaternion.FromAxis(Math.Vector3.Right, radians);

            _orientation = _orientation * rotation;
        }
Exemplo n.º 3
0
        public FrameTransformation(float[] matrix43)
        {
            _original.M11 = matrix43[0];
            _original.M12 = matrix43[1];
            _original.M13 = matrix43[2];
            _original.M14 = 0;

            _original.M21 = matrix43[3];
            _original.M22 = matrix43[4];
            _original.M23 = matrix43[5];
            _original.M24 = 0;

            _original.M31 = matrix43[6];
            _original.M32 = matrix43[7];
            _original.M33 = matrix43[8];
            _original.M34 = 0;

            _original.M41 = matrix43[9];
            _original.M42 = matrix43[10];
            _original.M43 = matrix43[11];
            _original.M44 = 1.0f;

            // TODO: scale
            _scale = Math.Vector3.One;

            _scale.X = (float)System.Math.Sqrt(
                matrix43[0 * 3 + 0] * matrix43[0 * 3 + 0] +
                matrix43[0 * 3 + 1] * matrix43[0 * 3 + 1] +
                matrix43[0 * 3 + 2] * matrix43[0 * 3 + 2]);
            _scale.Y = (float)System.Math.Sqrt(
                matrix43[1 * 3 + 0] * matrix43[1 * 3 + 0] +
                matrix43[1 * 3 + 1] * matrix43[1 * 3 + 1] +
                matrix43[1 * 3 + 2] * matrix43[1 * 3 + 2]);
            _scale.Z = (float)System.Math.Sqrt(
                matrix43[2 * 3 + 0] * matrix43[2 * 3 + 0] +
                matrix43[2 * 3 + 1] * matrix43[2 * 3 + 1] +
                matrix43[2 * 3 + 2] * matrix43[2 * 3 + 2]);

            // translation
            _translation.X = matrix43[3 * 3 + 0];
            _translation.Y = matrix43[3 * 3 + 1];
            _translation.Z = matrix43[3 * 3 + 2];

            // TODO: rotation
            _rotation = Math.Quaternion.FromAxis(Math.Vector3.Up, 0);
        }
Exemplo n.º 4
0
        public void AdjustYaw(float radians)
        {
            Math.Quaternion rotation = Math.Quaternion.FromAxis(Math.Vector3.Up, radians);

            _orientation = rotation * _orientation;
        }