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

PVector& rotate(double angle)

Rotates the vector by the specified angle in the XY plane. The Z value is not affected. This function modifies the vector.

Parameters

  • angle - the angle to rotate by, specified in radians

Returns

A reference to the vector.

Example

PVector v = new PVector(0, 1, 0);
v.rotate(90);
// v is now (1, 0, 0)
v.rotate(90);
// v is now (0, -1, 0)