GLSharp.Util.Matrix4X4.RotateX C# (CSharp) Method

RotateX() public method

public RotateX ( float angle ) : Matrix4X4
angle float
return Matrix4X4
        public Matrix4X4 RotateX(float angle)
        {
            float s = Math.Sin(angle);
            float c = Math.Cos(angle);

            // Cache the matrix values (makes for huge speed increases!)
            float a10 = Elements[4], a11 = Elements[5], a12 = Elements[6], a13 = Elements[7];
            float a20 = Elements[8], a21 = Elements[9], a22 = Elements[10], a23 = Elements[11];

            // Perform axis-specific matrix multiplication
            Elements[4] = a10*c + a20*s;
            Elements[5] = a11 * c + a21 * s;
            Elements[6] = a12 * c + a22 * s;
            Elements[7] = a13 * c + a23 * s;

            Elements[8] = a10 * -s + a20 * c;
            Elements[9] = a11 * -s + a21 * c;
            Elements[10] = a12 * -s + a22 * c;
            Elements[11] = a13 * -s + a23 * c;

            return this;
        }