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

@maplat/edgebound

v0.2.3

Published

A small library for dual-constraining a Delaunator triangulation

Readme

MaplatEdgebound

Maplat EdgeBound is a library for generating constrained triangulations based on Delaunator.

日本語のREADMEはこちら

Features

  • Applies edge constraints to Delaunator output
  • Supports multiple constraint types:
    • Required edge constraints (implemented in v0.1.0)
    • Forbidden edge constraints (planned for v0.3.0)
  • Fast algorithm with efficient memory usage
  • Implemented in TypeScript with complete type definitions

Installation

npm

# Install the main package
npm install @maplat/edgebound

# Install the required peer dependency
npm install delaunator

JSR (JavaScript Registry)

# For Deno
deno add @maplat/edgebound

# For npm/Node.js
npx jsr add @maplat/edgebound
npm install delaunator  # peer dependency

Deno

import EdgeBound from "https://deno.land/x/maplat_edgebound/mod.ts";
// or from a specific version
// import EdgeBound from "https://deno.land/x/[email protected]/mod.ts";

Note: The project includes a deno.json configuration file with import maps for dependencies. If you're using the module directly from source, you can also use the separate import_map.json:

deno run --import-map=import_map.json your_script.ts

Browser

Before installing Maplat EdgeBound, you need to load the following prerequisite library:

<!-- Prerequisite library -->
<script src="https://unpkg.com/delaunator/delaunator.min.js"></script>


<!-- Then load Maplat EdgeBound -->
<script src="https://unpkg.com/@maplat/edgebound/dist/maplat_edgebound.umd.js"></script>

Usage

Required Edge Constraints (v0.1.0)

import Delaunator from "delaunator";
import EdgeBound from "@maplat/edgebound";

// Define point data
const points = [[150, 50], [50, 200], [150, 350], [250, 200]];

// Generate initial triangulation using Delaunator
const del = Delaunator.from(points);

// Create constrained triangulation
const con = new EdgeBound(del);

// Add a required edge (e.g., connecting vertex 0 and vertex 2)
con.constrainOne(0, 2);

// Add multiple required edges at once
const edges = [[0, 1], [1, 2], [2, 3]];
con.constrainAll(edges);

// The constrained triangulation result is available in the del property
const constrainedDel = con.del;

Constraints

Input data must satisfy the following conditions:

  • No duplicate coordinates in the point set
  • No intersections between constraint edges
  • Constraint edges must not intersect with points other than their endpoints
  • The outer boundary of the triangulation must form a convex hull
  • The triangulation must not contain holes

The last two conditions are guaranteed by Delaunator, but care must be taken when modifying the triangulation.

Algorithm

Basic approach:

  • First, construct a regular Delaunay triangulation (using Delaunator)
  • Process and add the specified constraint edges
  • Detect and remove existing edges that intersect with constraint edges
  • Optimize to satisfy the Delaunay condition as much as possible while maintaining constraint edges

This algorithm is based on the following paper:

Performance

  • Achieves near-linear execution time O(N) for N points
  • Efficient memory usage through BitSet implementation
  • Additional cost for constraints typically less than 10%

Future Extensions (v0.3.0)

import Delaunator from "delaunator";
import {Forbid} from "@maplat/edgebound";

const del = Delaunator.from(points);
const fbd = new Forbid(del);
fbd.forbidAll(forbidEdges);  // Define forbidden edges
const forbidDel = fbd.del;   // Get constrained triangulation result

License

MIT License

Copyright (c) 2024 Code for History

Developers

  • Kohei Otsuka
  • Code for History

Credits

We welcome your contributions! Feel free to submit issues and pull requests.