Vector.magnitude

From GiderosMobile
Revision as of 09:22, 1 February 2026 by MoKaLux (talk | contribs) (Created page with "__NOTOC__ '''Available since:''' Gideros 2026.1<br/> '''Class:''' vector library<br/> === Description === Calculates the magnitude of a given vector. <syntaxhighlight lan...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2026.1
Class: vector library

Description

Calculates the magnitude of a given vector.

(number) = vector.magnitude(vec)

Parameters

vec: (vector) the vector to calculate the magnitude of

Return values

Returns (number) the magnitude of the given vector

Example

local vec : vector = vector.create(1, 2, 3)
local vec2 : vector  = vector.create(1, 2)

--local mag = vec:magnitude() -- error
local mag : number = vector.magnitude(vec)
local mag2 : number = vector.magnitude(vec2)
print(mag, mag2)