Show contents 

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

Matrix4.scale

Syntax

scale(v: PP.Vector3);

Parameters

v. Vector.

Description

The scale method scales model and view matrix.

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([
4.717621803283691, 0, 0, 0, 
0, 10.385396957397461, 0, 0,
0, 0, -1.0000020265579224, -1, 
0, 0, -0.002000001957640052, 0
]);
// Create a vector
vector = new PP.Vector3(1, 0.5, 2);
// Scale matrix
matrix.scale(vector);
// Get matrix values
matrix.getData();
// -> [4.717621803283691, 0, 0, 0, 0, 5.1926984786987305, 0, 0, 0, 0, -2.0000040531158447, -2, 0, 0, -0.002000001957640052, 0]

After executing the example the matrix is scaled.

See also:

Matrix4