vector
An array of any number of floats.
as-mat
as-mat()
Converts a vector to a row or column matrix.
as-vec
as-vec()
Ensures a vector has an exact number of components. This is done by passing another vector init that has the required dimension. If the original vector does not have enough dimensions, the values from init will be inserted. It is recommended to use a zero vector for init.
len
len()
Return length/magnitude of a vector.
add
add()
Adds two vectors of the same dimension
sub
sub()
Subtracts two vectors of the same dimension
dist
dist()
Calculates the distance between two vectors by subtracting the length of vector a from vector b.
scale
scale()
Multiplys a vector with scalar x
div
div()
Divides a vector by scalar x
neg
neg()
Negates each value in a vector
norm
norm()
Normalizes a vector (divide by its length)
element-product
element-product()
Multiply two vectors component-wise
dot
dot()
Calculates the dot product between two vectors.
cross
cross()
Calculates the cross product of two vectors with a dimension of three.
angle2
angle2()
Calculates the angle between two vectors and the x-axis in 2d space
angle
angle()
Calculates the angle between three vectors
lerp
lerp()
Linear interpolation between two vectors.