
A simple collection of functions for working with two-component vectors.
Example: Finding the distance between two points.
import { distanceBetween, vec2 } from '@4bitlabs/vec2';
const a = vec2(10, 20);
const b = vec2(3, 4);
const dist = distanceBetween(a, b);
Type Aliases
- Vec2
- MutableVec2
- RoundingMethodFn
Variables
- ZERO
Functions
- vec2
- clone
- assign
- set
- round
- add
- sub
- scale
- dot
- rotate
- project
- isEqual
- squaredDistanceBetween
- distanceBetween
- squaredLength
- length
- normalize
- toString
- lerp