Пример #1
0
        /*
         * Returns a 3D matrix based on the Z axis
         */
        public static Matrix Rotate3DZAxis(float alpha, bool reverse)
        {
            Matrix rotationMatrix = new Matrix(4, 4);

            float cos = GonioFactory.GetTrigonometricByRadians(alpha, Trigonometric.Cosine);
            float sin = GonioFactory.GetTrigonometricByRadians(alpha, Trigonometric.Sine);

            if (reverse)
            {
                sin = -sin;
            }

            float[,] data =
            {
                { cos, -sin, 0, 0 },
                { sin, cos,  0, 0 },
                {   0,    0, 1, 0 },
                {   0,    0, 0, 1 }
            };

            rotationMatrix.SetData(data);

            return(rotationMatrix);
        }
Пример #2
0
        /*
         * Calculates the scale based on the fieldofview and the near variable
         */
        public float GetScale()
        {
            var rad = GonioFactory.DegreesToRadians(_fieldOfView);

            return(_near * GonioFactory.GetTrigonometricByRadians(rad * 0.5f, Trigonometric.Tangent));
        }