Show contents 

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

Matrix4.mult

Syntax

mult(mat);

Parameters

mat. Matrix. PP.Matrix4.

Description

The mult method multiplies matrices.

Comments

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 second matrix
matrix2 = new PP.Matrix4([
2.717621803283691, 0, 0, 0, 
0, 8.385396957397461, 0, 0,
0, 0, -3.0000020265579224, -1, 
0, 0, 0.502000001957640052, 0
]);
// Multiply matrices
matrix.mult(matrix2)
// Get matrix values
matrix.getData();
// -> [12.820712089538574, 0, 0, 0, 0, 87.08567810058594, 0, 0, 0, 0, 3.0020079612731934, 3.000001907348633, 0, 0, -0.5020009875297546, -0.5019999742507935]

After executing the example two matrices are multiplied.

See also:

Matrix4