Skip to content

figureland/mathkit

Repository files navigation

mathkit illustration

CI NPM

mathkit is a collection of tools for working with numbers, matrices, shapes and more. The aim here is to have something minimal and unbloated, and also a place to learn by building from scratch.

Note

It would be great to use DOMMatrix and DOMPoint more. I could remove a big chunk of this library. But somehow I found them inflexible and didn't perform that well. Maybe something to do with having to call new DOMMatrix() every time you want to multiply two matrices, for example, feels as if it incurs a real cost if you're running it every frame. Maybe in 2024 that's not the case and when I have time I will revisit. They would need to be polyfilled somehow in Bun/node.js servers.

In the meantime, there are some helpers in src/style.ts to help with translation.

Credit to gl-matrix for inspiration, some API choices and indeed directly copying over a few methods. A library I've used many many times over the years.

Scripts

Install

bun install

Test

bun test

Build

bun run build