Name

angleBetween()

Class

PVector

Description

Calculates and returns the angle (in radians) between two vectors.

Examples

  • PVector v1 = new PVector(10, 20);
    PVector v2 = new PVector(60, 80); 
    float a = PVector.angleBetween(v1, v2);
    println(degrees(a));  // Prints "10.304827"
    

Syntax

  • .angleBetween(v1, v2)

Parameters

  • v1(PVector)the x, y, and z components of a PVector
  • v2(PVector)the x, y, and z components of a PVector

Return

  • float