Show contents 

Working with Graphic Elements > Classes > Matrix4 > Matrix4.setIdentity

Matrix4.setIdentity

Syntax

setIdentity();

Description

The setIdentity method sets an identify matrix.

Comments

The method sets matrix with values:

[ 1, 0, 0, 0,

  0, 1, 0, 0,

  0, 0, 1, 0,

  0, 0, 0, 1 ]

Example

To execute this example, in the HEAD tag of HTML page specify links to the following JS and CSS files: PP.js, PP.GraphicBase.js. Create a new matrix:

// Create a matrix
matrix = new PP.Matrix4();
// Set identify matrix
matrix.setIdentity();
// Get matrix values
matrix.getData();
// -> [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]

After executing the example a 4x4 identify matrix.

See also:

Matrix4