Vector.normalize

From GiderosMobile

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)