Vector.normalize

From GiderosMobile
Revision as of 10:08, 2 February 2026 by MoKaLux (talk | contribs)
(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.

(vector) = vector.normalize(vec)

Parameters

vec: (vector) the vector to normalize

Return values

Returns (vector) 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)