Skip to content

aninest root / Vec2

Vec2

A collection of 2D vector math functions and a few other generic scalar operations.

Description

Vectors are represented as {x: number, y: number} and are meant to be immutable, following a functional programming style.

Index

Type Aliases

Type aliasDescription
Vec2A 2D vector.

Variables

VariableDescription
ZERO_VEC2A 2D vector with x and y set to 0.

Functions

FunctionDescription
addVec-
bezier-
clamp-
copy-
cross-
distanceTo-
distanceTo2-
divScalar-
divVec-
dot-
lerp-
lerpFunc-
mag-
magSquared-
mapVec-
mulScalar-
mulVec-
newVec2-
normalize-
rotate-
rotateAround-
subVec-
vecToIter-