Performs modulo (remainder) division with a vector's x
, y
, and z
components.
rem()
can use separate numbers, as in v.rem(1, 2, 3)
, another p5.Vector object, as in v.rem(v2)
, or an array of numbers, as in v.rem([1, 2, 3])
.
If only one value is provided, as in v.rem(2)
, then all the components will be set to their values modulo 2. If two values are provided, as in v.rem(2, 3)
, then v.z
won't change. Calling rem()
with no arguments, as in v.rem()
, has no effect.
The static version of rem()
, as in p5.Vector.rem(v2, v1)
, returns a new p5.Vector object and doesn't change the originals.
Examples
Syntax
rem(x, y, z)
rem(value)
rem(v1, v2)
rem(v1, v2)
Parameters
x component of divisor vector.
y component of divisor vector.
z component of divisor vector.
divisor vector.
The dividend p5.Vector
The divisor p5.Vector