rem()

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.

예제

구문

rem(x, y, z)
rem(value)
rem(v1, v2)
rem(v1, v2)

매개변수

x
Number:

x component of divisor vector.

y
Number:

y component of divisor vector.

z
Number:

z component of divisor vector.

value
p5.Vector | Number[]:

divisor vector.

v1
p5.Vector:

The dividend p5.Vector

v2
p5.Vector:

The divisor p5.Vector

Notice any errors or typos? Please let us know. Please feel free to edit src/math/p5.Vector.js and open a pull request!

관련 레퍼런스