Identity() public method

Identity matrix
public Identity ( ) : void
return void
Beispiel #1
0
        /// <summary>
        /// get a matrix used to rotate object specific angle on Z direction
        /// </summary>
        /// <param name="angle">rotate angle</param>
        /// <returns>matrix which rotate object specific angle on Z direction</returns>
        public static Matrix4 RotateZ(double angle)
        {
            Matrix4 rotateX = new Matrix4();

            rotateX.Type = MatrixType.Rotation;
            rotateX.Identity();
            double sin = (double)Math.Sin(angle);
            double cos = (double)Math.Cos(angle);

            rotateX.Matrix[1, 1] = cos;
            rotateX.Matrix[1, 2] = sin;

            rotateX.Matrix[2, 1] = -sin;
            rotateX.Matrix[2, 2] = cos;
            return(rotateX);
        }
Beispiel #2
0
        /// <summary>
        /// get a matrix used to rotate object specific angle on Z direction
        /// </summary>
        /// <param name="angle">rotate angle</param>
        /// <returns>matrix which rotate object specific angle on Z direction</returns>
        public static Matrix4 RotateZ(double angle)
        {
            Matrix4 rotateX = new Matrix4();
            rotateX.Type = MatrixType.Rotation;
            rotateX.Identity();
            double sin = (double)Math.Sin(angle);
            double cos = (double)Math.Cos(angle);
            rotateX.Matrix[1, 1] = cos;
            rotateX.Matrix[1, 2] = sin;

            rotateX.Matrix[2, 1] = -sin;
            rotateX.Matrix[2, 2] = cos;
            return rotateX;
        }