JSPM

@maptalks/martini

0.4.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 202
    • Score
      100M100P100Q78857F
    • License ISC

    A JavaScript library for real-time terrain mesh generation

    Package Exports

    • @maptalks/martini
    • @maptalks/martini/index.js
    • @maptalks/martini/martini.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@maptalks/martini) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    MARTINI

    Build Status Simply Awesome

    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.

    Based on the paper "Right-Triangulated Irregular Networks" by Will Evans et. al. (1997).

    MARTINI terrain demo

    Example

    // 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

    npm install @mapbox/martini