Name

div()

Examples
v = PVector(30, 60, 0)

ellipse(v.x, v.y, 12, 12)
v.div(6)
ellipse(v.x, v.y, 24, 24)
v1 = PVector(30, 60, 0)
ellipse(v1.x, v1.y, 12, 12)
v2 = PVector.div(v1, 6)
ellipse(v2.x, v2.y, 24, 24)
Description Divides a vector by a scalar. The version of the method that uses a float acts directly on the vector upon which it is called (as in the first example above), and therefore has no return value. The versions that receive both a PVector and a float as arugments are static methods, and each returns a new PVector that is the result of the division operation. Both examples above produce the same visual output.
Syntax
.div(n)
.div(v, n)
.div(v, n, target)
Parameters
nfloat: the number by which to divide the vector
vPVector: the vector to divide by the scalar
targetPVector: PVector in which to store the result

Updated on Tue Feb 27 14:07:12 2024.

If you see any errors or have comments, please let us know.