a port of the Processing Visualization Language
Class PVector
Name

mag()

Examples
PVector v;

void setup() {
  size(100, 100);
  v = new PVector(20.0, 30.0, 40.0);
  float m = v.mag();
  println(m);  // Prints "53.851646"
}
Description

Calculates the magnitude (length) of the vector and returns the result as a float (this is simply the equation sqrt(x*x + y*y + z*z).)

Syntax
vec.mag()
Parameters
vec any variable of type PVector
Returns float
Usage Web & Application

This reference is licensed under the CC BY-NC-SA 2.0 license:

Creative Commons License
Fork me on GitHub