Vector.angle

From GiderosMobile
Revision as of 11:08, 2 February 2026 by MoKaLux (talk | contribs) (Created page with "__NOTOC__ '''Available since:''' Gideros 2026.1<br/> '''Class:''' vector library<br/> === Description === Computes the angle between two vectors in radians. <syntaxhighli...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2026.1
Class: vector library

Description

Computes the angle between two vectors in radians.

(number) = vector.angle(vec1,vec2[,axis])

The axis, if specified, is used to determine the sign of the angle.

Parameters

vec1: (vector) the first vector
vec2: (vector) the second vector
axis: (vector) to determine the sign of the angle Optional

Return values

Returns (number) returns the 3-dimensional angle in radians

Example

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

local ang = vector.angle(vec1, vec2, vec1)
print(typeof(ang), ang) -- number	0.7751933915024549