Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mapbox/martini
A JavaScript library for real-time RTIN terrain mesh generation
https://github.com/mapbox/martini
Last synced: 8 days ago
JSON representation
A JavaScript library for real-time RTIN terrain mesh generation
- Host: GitHub
- URL: https://github.com/mapbox/martini
- Owner: mapbox
- License: isc
- Created: 2019-08-14T14:18:19.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-10-28T14:44:31.000Z (about 2 years ago)
- Last Synced: 2024-08-01T00:50:14.209Z (3 months ago)
- Language: JavaScript
- Homepage: https://observablehq.com/@mourner/martin-real-time-rtin-terrain-mesh
- Size: 1.31 MB
- Stars: 609
- Watchers: 103
- Forks: 41
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MARTINI
[![Build Status](https://travis-ci.com/mapbox/martini.svg?branch=main)](https://travis-ci.com/mapbox/martini) [![Simply Awesome](https://img.shields.io/badge/simply-awesome-brightgreen.svg)](https://github.com/mourner/projects)
MARTINI stands for **Mapbox's Awesome Right-Triangulated Irregular Networks, Improved**.
It's an experimental JavaScript library for **real-time terrain mesh generation** from height data. Given a (2k+1) × (2k+1) terrain grid, it generates a hierarchy of triangular meshes of varying level of detail in milliseconds. _A work in progress._
See the algorithm in action and read more about how it works in [this interactive Observable notebook](https://observablehq.com/@mourner/martin-real-time-rtin-terrain-mesh).
Based on the paper ["Right-Triangulated Irregular Networks" by Will Evans et. al. (1997)](https://www.cs.ubc.ca/~will/papers/rtin.pdf).
![MARTINI terrain demo](martini.gif)
## Example
```js
// set up mesh generator for a certain 2^k+1 grid size
const martini = new Martini(257);// generate RTIN hierarchy from terrain data (an array of size^2 length)
const tile = martini.createTile(terrain);// get a mesh (vertices and triangles indices) for a 10m error
const mesh = tile.getMesh(10);
```## Install
```bash
npm install @mapbox/martini
```### Ports to other languages
- [pymartini](https://github.com/kylebarron/pymartini) (Python)