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

@muralco/geometry

v1.1.0

Published

2D geometric library for spatial computation

Readme

Geometry Primitives

This package provides essential geometric primitives and utilities for 2D graphics and spatial calculations in Mural applications.

Available Primitives

Point

A basic interface representing a point or vector in 2D space with x and y coordinates.

For points we use POJO like { x: 0, y: 0 } to make it easy to serialize/deserialize it. Use namespace syntax to access points methods (Point.add(p1, { x: dx, y: dy })).

Other geometry primitives like Aabb and Obb are regular JS classes.

import { Point } from '@muralco/geometry';

// Example usage
const { add, scale, fromSize } = Point;
const center = add(leftTop, scale(fromSize(size), 0.5));

The Point namespace provides numerous utility functions for vector operations, including:

  • Vector arithmetic (add, sub, mul, etc.)
  • Normalization and scaling
  • Distance and length calculations

Matrix

A 2D transformation matrix for representing and combining translations, rotations, and scaling.

import { Matrix } from '@muralco/geometry';

// Rotation around a specific point
const matrix = Matrix.identity()
  .translate(Point.neg(origin))
  .rotate(angleInRadians)
  .translate(origin);

const transformedPoint = matrix.transform(myPoint);

Aabb (Axis-Aligned Bounding Box)

A rectangle defined by minimum and maximum X/Y coordinates, always aligned to the coordinate axes.

import { Aabb } from '@muralco/geometry';

// Create from points
const bounds = Aabb.fromPoints([point1, point2, point3]);

// Check if a point is inside
if (bounds.includesPoint(somePoint)) {
  // Point is inside the bounding box
}

Obb (Oriented Bounding Box)

A rectangle with arbitrary orientation, defined by a size and a transformation matrix.

import { Obb } from '@muralco/geometry';

// Create an OBB
const obb = new Obb(
  { width: 100, height: 50 },
  Matrix.rotation(Math.PI / 4) // 45 degrees rotation
);

// Map points between spaces
const globalPoint = obb.mapToGlobal(localPoint);

Angles (Radians/Degrees)

There are two angle representations in this package: Radians and Degrees. Both are tagged types to not confuse them with regular numbers, or use with incorrect units.

import { Radians, Degrees } from '@muralco/geometry';

// Create a Radians value from a regular number
const r: Radians = Radians(Math.PI / 2);

// Create a Degrees value from a regular number
const d: Degrees = Degrees(90);

// Convert between radians and degrees
const radians1: Radians = Radians.fromDegrees(90);
const degrees1: Degrees = Radians.toDegrees(radians1);

const degrees2 = Degrees(45); // Just add the `Degrees` tag to a number
const radians2 = Degrees.toRadians(degrees2);

// Normalize to [0, 2π)
const normalizedRadians = Radians.normalize(radians1);

// Normalize to [0, 360)
const normalizedDegrees = Degrees.normalize(degrees1);