A high performance linear algebra library using native JS arrays. Geared
towards 3D graphics and use with Graphics.WebGL. All vectors are immutable.
Creates a new 2-element vector with the given values.
The set functions create a new copy of the vector, updating a single field.
Extract the x component of a vector.
Extract the y component of a vector.
Update the x component of a vector, returning a new vector.
Update the y component of a vector, returning a new vector.
Vector addition: a + b
Vector subtraction: a - b
Vector negation: -a
Multiply the vector by a scalar: s * v
The dot product of a and b
A unit vector with the same direction as the given vector: a / |a|
The normalized direction from b to a: (a - b) / |a - b|
The length of the given vector: |a|
The square of the length of the given vector: |a| * |a|
The distance between two vectors.
The square of the distance between two vectors.
Convert a vector to a tuple.
Convert a tuple to a vector.
Convert a vector to a record.
Convert a record to a vector.
Two dimensional vector type