multiplyByScalar

fun multiplyByScalar(matrix: Matrix4, scalar: Double, result: Matrix4): Matrix4(source)

Computes the product of a matrix and a scalar.

//create a Matrix4 instance which is a scaled version of the supplied Matrix4
// m = [10.0, 11.0, 12.0, 13.0]
// [14.0, 15.0, 16.0, 17.0]
// [18.0, 19.0, 20.0, 21.0]
// [22.0, 23.0, 24.0, 25.0]

const a = Matrix4.multiplyByScalar(m, -2, new Matrix4());

// m remains the same
// a = [-20.0, -22.0, -24.0, -26.0]
// [-28.0, -30.0, -32.0, -34.0]
// [-36.0, -38.0, -40.0, -42.0]
// [-44.0, -46.0, -48.0, -50.0]

Return

The modified result parameter.

Parameters

matrix

The matrix.

scalar

The number to multiply by.

result

The object onto which to store the result.

See also