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

RotateZ() public method

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

            // Cache the matrix values (makes for huge speed increases!)
            float a00 = Elements[0], a01 = Elements[1], a02 = Elements[2], a03 = Elements[3];
            float a10 = Elements[4], a11 = Elements[5], a12 = Elements[6], a13 = Elements[7];

            // Perform axis-specific matrix multiplication
            Elements[0] = a00 * c + a10 * s;
            Elements[1] = a01 * c + a11 * s;
            Elements[2] = a02 * c + a12 * s;
            Elements[3] = a03 * c + a13 * s;

            Elements[4] = a00 * -s + a10 * c;
            Elements[5] = a01 * -s + a11 * c;
            Elements[6] = a02 * -s + a12 * c;
            Elements[7] = a03 * -s + a13 * c;

            return this;
        }