Reference angleBetween()

angleBetween()

Calculates the angle between two vectors.

The angles returned are signed, which means that v1.angleBetween(v2) === -v2.angleBetween(v1).

If the vector was created with createVector(), angleBetween() returns angles in the units of the current angleMode().

Examples

Syntax

angleBetween(value)
angleBetween(v1, v2)

Parameters

value
p5.Vector:

x, y, and z components of a p5.Vector.

v1
p5.Vector:

the first vector.

v2
p5.Vector:

the second 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!

Related References