mag()

Calculates the magnitude (length) of the vector.

Use mag() to calculate the magnitude of a 2D vector using components as in mag(x, y).

예제

구문

mag()
mag(vecT)

매개변수

vecT
p5.Vector:

The vector to return the magnitude of

Returns

Number: magnitude of the 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!

관련 레퍼런스