# mapbox/earcut

The fastest and smallest JavaScript polygon triangulation library for your WebGL apps

Repository: https://github.com/mapbox/earcut
Canonical: https://ross.abutalabs.com/products/earcut
Homepage: https://mapbox.github.io/earcut/viz/
Language: JavaScript
License: ISC
License Family: permissive
Topics: triangulation, tessellation, polygon, algorithm, computational-geometry, javascript, delaunay
Last push: 2026-08-02T08:44:32+00:00

## Health v2 (maintenance only)
Score: 95/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 95, release rhythm 91, longevity 100
- inputs: {"age_days": 4247, "days_push": 31, "days_rel": 62, "gap_med": 0, "n_releases_24m": 8}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2580, forks 226 (observed 2026-08-28T04:07:02.385501+00:00)

## What it is
Earcut is a fast, tiny (4KB gzipped) JavaScript polygon triangulation library implementing a modified ear-slicing algorithm optimized with z-order curves and spatial hashing. It is designed for real-time triangulation in WebGL apps like Mapbox GL JS and Three.js, with optional Delaunay refinement.

## Use cases
- triangulate polygons for WebGL rendering
- convert polygon vertices into triangle indices for Three.js meshes
- triangulate map vector tile polygons in real time
- handle polygons with holes and self-intersections
- produce Delaunay-quality triangulations at a small performance cost

## When to choose
- you need fast real-time triangulation in the browser or Node.js
- bundle size matters and you want a minimal dependency
- you're rendering geographic or map polygons in WebGL
- your input polygons are reasonably clean and speed matters more than guaranteed correctness

## When to avoid
- you need a guaranteed-correct triangulation on arbitrary or dirty input
- you need high-quality triangulations with strict angle guarantees
- you're working outside JavaScript/TypeScript ecosystems

## Facets
- artifact type: library
- maturity: stable
- function: graphics, math, parser
- domain: graphics, web-development
- platform: browser, cross-platform
- tags: triangulation, tessellation, computational-geometry, delaunay, webgl, polygon, ear-clipping, algorithms, maps, nodejs

## Member repositories
- mapbox/earcut (main) score 95

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:02.385501+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:22:38.941814+00:00, confidence not recorded.
  - readme: https://github.com/mapbox/earcut (fetched 2026-08-28T04:07:02.385501+00:00, sha 58229ccbe3e4)
  - homepage: https://mapbox.github.io/earcut/viz/ (fetched 2026-08-29T10:05:27.168468+00:00, sha 5e48f87f3452)
  - registry_npm: https://registry.npmjs.org/earcut (fetched 2026-08-29T10:05:27.177383+00:00, sha 42b3de897d04)
- Data as of 2026-08-30T08:39:29.467469+00:00.
