mag()

Math / Calculation

Description

Calculates the magnitude (length) of a vector. Supports 2D and 3D.

Syntax

float mag(float x, float y) float mag(float x, float y, float z)

Parameters

NameTypeDescription
xfloatx component
yfloaty component
zfloatz component (optional)

Returns

float

Related

Under the Hood

Implementation in Processing.h / Processing.cpp:

Loading...