Vector.normalize

From GiderosMobile
Revision as of 14:26, 1 February 2026 by MoKaLux (talk | contribs) (Created page with "__NOTOC__ '''Available since:''' Gideros 2026.1<br/> '''Class:''' vector library<br/> === Description === Computes the normalized version (unit vector) of a given vector....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2026.1
Class: vector library

Description

Computes the normalized version (unit vector) of a given vector.

(table) = vector.normalize(vec)

Parameters

vec: (vector) the vector to normalize

Return values

Returns (table) the normalized version of the given vector

Example

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

local norm : vector = vector.normalize(vec)
local norm2 : vector = vector.normalize(vec2)
print(norm)
print(norm2)