Article may be outdated

This article is 45 days old. Some details may have changed since publication.

Hacker News·5 min read·hard

Faster than earcut: triangulating 3.7M map polygons in 489 ms

M
molind
Faster than earcut: triangulating 3.7M map polygons in 489 ms
✦AI Summary

A developer has released 'earstrip,' a new C++ library for polygon triangulation that significantly outperforms the industry-standard 'earcut' library. The post details the technical optimizations and geometric principles used to achieve faster rendering speeds for map data.

Why it matters

Efficient geometric processing is critical for high-performance mapping software and real-time rendering in modern web and desktop applications.

✦Dive DeeperCreate a free account to unlock

We have published the polygon triangulator of our map engine as a small library, earstrip , under the ISC license, the same one earcut uses. It is one C++ header, and a WebAssembly build on npm that takes the same arguments as earcut. In C++ it is 14% faster than earcut.hpp, in the browser 1.4 to 2.1 times as fast as earcut.js, and the comparison is near the end. This post is about how we got there.

A GPU fills triangles and nothing else. A map, on the other hand, is mostly polygons: buildings, parks, parking lots, the strip of grass between two tram tracks. Here are a few blocks of Śródmieście in Warsaw the way our renderer reads them from a map file, as outlines :

Continue reading on Headlinne

Create a free account to read the full article.

Read full article →
technologyscience
✦

Get smarter about the news

Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.

Create free account

Already have an account? Sign in