Calculates the magnitude (length) of the vector.
Use mag() to calculate the magnitude of a 2D vector using components as in mag(x, y)
.
Examples
Syntax
mag()
mag()
mag(vecT)
Parameters
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!
Related References
textToContours
Returns an array of arrays of points outlining a string of text written using the font.
textToModel
Converts text into a 3D model that can be rendered in WebGL mode.
textToPaths
Returns a flat array of path commands that describe the outlines of a string of text.
textToPoints
Returns an array of points outlining a string of text written using the font.