Calculates the angle a 2D vector makes with the positive x-axis.
By convention, the positive x-axis has an angle of 0. Angles increase in the clockwise direction.
If the vector was created with createVector(), heading()
returns angles in the units of the current angleMode().
The static version of heading()
, as in p5.Vector.heading(v)
, works the same way.
उदाहरण
सिंटैक्स
heading()
heading(v)
पैरामीटर्स
v
p5.Vector:
the vector to find the angle of
Returns
Number: angle of rotation.
Notice any errors or typos? Please let us know. Please feel free to edit src/math/p5.Vector.js and open a pull request!