A simple collection of functions for working with two-component vectors.
$ npm install --save @4bitlabs/vec2
Full documentation for the library can be found here.
import { type Vec2, vec2, toString, dot } from '@4bitlabs/vec2';
const v1: Vec2 = vec2(8.14, 10.1);
const v2: Vec2 = vec2(1.45, 3.92);
const result = dot(v1, v2);
console.log(
`The dot-product of ${toString(v1)} and ${toString(v2)} is ${result}`,
);