Skip to main content Link Menu Expand (external link) Document Search Copy Copied

PVector& add(PVector other)

Adds the components of the other vector to the vector that is operated on. This function is equivalent to using the operator+= function.

This function returns a reference to the vector that the function was called on to use in chaining.

Parameters

  • other - The vector to add to the current vector

Returns

A reference to the vector

Examples

PVector v = PVector(1, 2);
PVector o = PVector(3, 4, 5);

v.add(o);
/*
v.x == 4
v.y == 6
v.z == 5
*/

See Also