Represents a mathematical vector
alias vector<a, n> = a[n]
Equal to 0. Represents the index of the x dimension
uint8
Equal to 1. Represents the index of the y dimension
uint8
Equal to 2. Represents the index of the z dimension
uint8
Adds two vectors and returns the results.
(vector<a, n>, vector<a, n>) -> vector<a, n> where a : num
v1 : vector<a, n> | The first vector to add |
v2 : vector<a, n> | The second vector to add |
The sum of the two vectors
() -> vector<a, n> where a : num
Returns the zero vector of n dimensions.
The zero vector of n dimensions.
The vector subtraction operation.
v1 : vector<a, n> | The first vector (minuend) |
v2 : vector<a, n> | The second vector (subtrahend) |
(vector<a, n>, vector<a, n>) -> vector<a, n> where a : num
The vector difference v1-v2
Scales the vector by the given scalar value.
(a, vector<a, n>) -> vector<a, n> where a : num
scalar : a | Scaling value |
v : vector<a, n> | The vector to scale |
The result of scalar*v
Gives the dot product of two vectors
(vector<a, n>, vector<a, n>) -> a where a : num
v1 : vector<a, n> | The first vector |
v2 : vector<a, n> | The second vector |
The result of v1 dot v2
Gives the square magnitude of the vector
(vector<a, n>) -> a where a : num
v : vector<a, n> | The vector to find the magnitude^2 of |
The square magnitude of the vector
Gives the magnitude of the vector
(vector<a, n>) -> double where a : num
v : vector<a, n> | The vector to find the magnitude of |
The magnitude of the vector
Performs elementwise multiplication of two vectors.
(vector<a, n>, vector<a, n>) -> vector<a, n> where a : num
u : vector<a, n> | The first vector |
v : vector<a, n> | The second vector |
The vector formed by elementwise multiplication of the two vectors
Returns a normalized version of the given vector
(vector<a, n>) -> vector<a, n> where a : num
v : vector<a, n> | The vector to normalize |
The normalized vector. If the input vector is the zero vector, the zero vector is returned.
Gives the angle in radians between the two vectors.
(vector<a, n>, vector<a, n>) -> double where a : num
v1 : vector<a, n> | The first vector |
v2 : vector<a, n> | The second vector |
The angle betweeen the two vectors.
Gives the vector cross product of two vectors.
(vector<a, 3>, vector<a, 3>) -> vector<a, 3> where a : num
u : vector<a, 3> | The first vector |
v : vector<a, 3> | The second vector |
The result of u cross v
Projects vector a onto another vector b
(vector<z, n>, vector<z, n>) -> vector<z, n> where z : num
a : vector<z, n> | The vector to project |
b : vector<z, n> | The other vector |
The result of projecting vector a onto vector b
Projects a vector onto a plane defined by a normal vector
(vector<z, n>, vector<z, n>) -> vector<z, n> where z : num
a : vector<z, n> | The vector to project |
m : vector<z, n> | The vector normal to the plane |
Vector a projected onto the plane defined by m