Beispiel #1
0
        /*
         * Calculates the pespective screensize
         */

        public float GetScreenSize()
        {
            var tan      = GonioFactory.GetTrigonometricByDegrees(_fieldOfView / 2, Trigonometric.Tangent);
            var halfSize = tan * _far;

            return(halfSize * 2);
        }
Beispiel #2
0
        /*
         * Returns a 2D rotation matrix.
         */
        public static Matrix Rotate2D(float alpha)
        {
            Matrix rotationMatrix = new Matrix(2, 2);

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

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

            rotationMatrix.SetData(data);

            return(rotationMatrix);
        }