Math module

multiply

procedure · 3 overloadsSource

Multiplies a vector by a scalar (v * f), or applies a matrix to a column vector (m * v) or to another matrix (a * b). The operator * is the same for every pairing here: this is the named form of it, convenient to pass as a procedure. See each matrix type for the shapes.

ExampleOpen in playground ↗
assert(multiply(xyz(1, 2, 3), 2) == xyz(2, 4, 6));
assert(multiply(Matrix3_Identity, xyz(1, 2, 3)) == xyz(1, 2, 3));
multiply :: (v: Vector2, f: float) -> Vector2

Scales every component of v by f.

Parameters

v: Vector2
the vector to scale.
f: float
the scale factor.

Returns

multiply :: (v: Vector3, f: float) -> Vector3

Scales every component of v by f.

Parameters

v: Vector3
the vector to scale.
f: float
the scale factor.

Returns

multiply :: (v: Vector4, f: float) -> Vector4

Scales every component of v by f.

Parameters

v: Vector4
the vector to scale.
f: float
the scale factor.

Returns

See also