# mapbox/earcut.hpp

Fast, header-only polygon triangulation

Repository: https://github.com/mapbox/earcut.hpp
Canonical: https://ross.abutalabs.com/products/earcuthpp
Language: C++
License: ISC
License Family: permissive
Topics: earcut, triangulation, tessellation, geometry, algorithm, rendering, cpp, header-only, polygon
Last push: 2026-07-07T12:52:36+00:00

## Health v2 (maintenance only)
Score: 82/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 91, release rhythm 59, longevity 100
- inputs: {"age_days": 4214, "days_push": 57, "days_rel": 61, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1023, forks 152 (observed 2026-08-28T04:03:15.945095+00:00)

## What it is
A fast, header-only C++ port of the earcut.js polygon triangulation library, implementing a modified ear-slicing algorithm optimized with z-order curves and spatial hashing. It handles holes, self-intersections, and degeneracies, producing triangle indices suitable for real-time rendering of geographic and other 2D polygon data.

## Use cases
- triangulate polygons with holes in C++
- convert geographic polygon shapes to triangle meshes for rendering
- fast real-time tessellation for a map renderer
- triangulate self-intersecting or non-simple polygons robustly
- header-only polygon triangulation without dependencies
- generate triangle indices for WebGL/OpenGL drawing

## When to choose
- you need a small, dependency-free, header-only triangulation library
- raw triangulation speed matters more than guaranteed optimal mesh quality
- you're rendering geographic or map polygons in real time
- your polygons may contain holes, degeneracies, or self-intersections

## When to avoid
- you need mathematically guaranteed-correct triangulation of arbitrary polygons
- you require high-quality Delaunay meshes as the primary output
- you need 3D or constrained Delaunay triangulation

## Facets
- artifact type: library
- maturity: stable
- function: graphics, math, parser
- domain: graphics
- platform: cpp, cross-platform
- tags: header-only, triangulation, tessellation, computational-geometry, ear-clipping, polygon-mesh, algorithms, maps, game-development

## Member repositories
- mapbox/earcut.hpp (main) score 82

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:03:15.945095+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-30T07:08:38.651066+00:00, confidence not recorded.
  - readme: https://github.com/mapbox/earcut.hpp (fetched 2026-08-28T04:03:15.945095+00:00, sha 413f4a008400)
- Data as of 2026-08-30T08:39:29.467469+00:00.
