Name

heading()

Class

PVector

Description

Calculate the vector's direction, that is, the angle this vector makes with the positive X axis (only 2D vectors)

Examples

  • PVector v;
    
    void setup() {
      v = new PVector(10.0, 20.0);
      println(v.heading());  // Prints "1.1071488"
    }
    

Syntax

  • myPVector.heading()

Parameters

  • myPVector(PVector)your PVector object

Return

  • float