npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zakkster/lite-sat

v1.0.1

Published

Zero-allocation 2D convex polygon SAT collision with MTV (Minimum Translation Vector).

Readme

@zakkster/lite-sat

npm version npm bundle size npm downloads npm total downloads TypeScript Dependencies License: MIT

💥 What is lite-sat?

@zakkster/lite-sat is a zero-allocation convex polygon collision detector using the Separating Axis Theorem.

It gives you:

  • 💥 Convex polygon vs polygon collision
  • 📐 MTV (Minimum Translation Vector) for resolution
  • 0️⃣ Zero allocations — module-scoped Float32Array scratchpads
  • 🔺 Handles triangles, quads, and any convex N-gon
  • 🛡️ Degenerate polygon guard (< 3 vertices rejected)
  • 🪶 < 1 KB minified

Feed it flat [x1,y1,x2,y2,...] arrays — the same format as your SoA engine.

Part of the @zakkster/lite-* ecosystem — micro-libraries built for deterministic, cache-friendly game development.

🚀 Install

npm i @zakkster/lite-sat

🕹️ Quick Start

import { testPolygonPolygon } from '@zakkster/lite-sat';

const polyA = new Float32Array([0,0, 10,0, 10,10, 0,10]);
const polyB = new Float32Array([5,5, 15,5, 15,15, 5,15]);
const mtv = new Float32Array(2);

if (testPolygonPolygon(polyA, polyB, mtv)) {
    // Collision! Push A away from B:
    polyA[0] += mtv[0]; polyA[1] += mtv[1];
    polyA[2] += mtv[0]; polyA[3] += mtv[1];
    // ... for all vertices
}

🧠 Why This Exists

Existing SAT libraries allocate a Response object per test. lite-sat uses module-scoped Float32Array caches — the same 4 arrays are reused across every call.

📊 Comparison

| Library | Size | Allocations | MTV | Install | |---------|------|-------------|-----|---------| | sat | ~4 KB | Response object per test | Yes | npm i sat | | collisions | ~8 KB | High | Yes | npm i collisions | | lite-sat | < 1 KB | Zero (Float32Array caches) | Yes | npm i @zakkster/lite-sat |

⚙️ API

testPolygonPolygon(polyA, polyB, outMTV)

| Parameter | Type | Description | |-----------|------|-------------| | polyA | Float32Array \| number[] | Flat vertex array [x1,y1,x2,y2,...] | | polyB | Float32Array \| number[] | Flat vertex array | | outMTV | Float32Array(2) | Pre-allocated push vector (written on collision) |

Returns true if overlapping. MTV always pushes A away from B.

🧪 Benchmark

100,000 polygon pair tests:
  sat.js:     12ms (Response object per test)
  lite-sat:    4ms (module-scoped Float32Array caches)

📦 TypeScript

Full TypeScript declarations included in testPolygonPolygon.d.ts.

📚 LLM-Friendly Documentation

See llms.txt for AI-optimized metadata and usage examples.

License

MIT