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

@desicochrane/delaunay

v0.1.2

Published

[![Coverage Status](https://coveralls.io/repos/github/desicochrane/delaunay/badge.svg?branch=master)](https://coveralls.io/github/desicochrane/delaunay?branch=master)

Readme

Delaunay

Coverage Status

Dependency-free implementation of the divide-and-conquer Delaunay Triangulation algorithm.

Getting started

  1. npm i @desicochrane/delaunay
  2. import and triangulate your point set:
    import Delaunay, {UniqueEdges} from '@desicochrane/delaunay'
    
    // define your point set
    const pts = [ [1,1], [1,2], [3,4], [4,5] ]
    
    // compute triangulation graph
    const graph = Delaunay(pts)
    
    // get unique edges from graph
    const edges = UniqueEdges(graph)

The Algorithm

This package takes a divide-and-conquer approach in the same flavor as merge-sort, the basic idea goes something like:

  1. Sort the points left to right
  2. Divide the points into halves until point set has size 2 or 3
  3. Triangulate the 2 or 3 point sets manually
  4. Merge the triangulations together

A sample code of the main routine would look something like this:

function Delaunay(pts) {
    // the output will be an adjacency list of edges
    const edges = {}
    
    // pass edges into the recursive procedure
    delaunay(edges, pts.sort(PointSort), 0, pts.length-1)
    
    return edges
}

function delaunay(edges, pts, min, max) {
    // how many points are we triangulating
    const size = max-min+1
    
    // zero or 1 point is the trivial delaunay triangulation 
    if (size < 1) return edges
    
    // 2 points can be computed easily
    if (size == 2) return Triangulate2(edges, pts[min], pts[max])
    
    // 3 points can be computed easily
    if (size == 3) return Triangulate3(edges, pts[min], pts[min+1], pts[max])
    
    // otherwise we divide into halves:
    const mid = min+((max-min)>>>1)
    
    delaunay(edges, pts, min, mid)
    delaunay(edges, pts, mid+1, max)
    
    // and then merge the results
    return Merge(adj, mid, mid+1)
}

What remains then is to specify the subroutines PointSort, Triangulate2, Triangulate3, and Merge.

PointSort Subroutines

todo

Triangulate2+3 Subroutines

todo

Merge Subroutine

todo

Geometry Prerequisites

The implementation depends on the following geometric concepts and properties:

PseudoAngle

todo

RightOf

todo

Circumscribed

todo

Convex Hull

todo

Data Structures

The efficiency depends heavily on being able to traverse the triangulation efficiently, to do so we construct a Vertex Cycle data structure which is effectively a specialised Cyclic Linked List.

Cyclic Linked List

todo

Vertex Cycle

todo