Built-in functions – Vector functions

Vector constructors

vec2(real x, real y) vec2

Returns the 2-vector (x, y).

vec2(real x) vec2

Returns the 2-vector (x, x).

vec3(real x, real y, real z) vec3

Returns the 3-vector (x, y, z).

vec3(real x) vec3

Returns the 3-vector (x, x, x).

Vector functions

dot(vec2 a, vec2 b) real
dot(vec3 a, vec3 b) real

Returns the dot product of a and b.

cross(vec3 a, vec3 b) vec3

Returns the cross product of a and b.

length(vec2 a) real
length(vec3 a) real

Returns the length of a, ||a||.

normalise(vec3 a) vec3

Returns a / ||a||