mapbox / martini

A JavaScript library for real-time RTIN terrain mesh generation
https://observablehq.com/@mourner/martin-real-time-rtin-terrain-mesh
ISC License
612 stars 41 forks source link

Simplifying non-square meshes #14

Open peterqliu opened 4 years ago

peterqliu commented 4 years ago

Great library @mourner. I've been adapting this to simplify non-square meshes, by buffering the east and southern edges with filler values. This forms a bigger square, whatever the next larger 2^n +1 integer may be (a 225x500 mesh becomes 513x513).

To keep the algorithm from simplifying away vertices on the real edge, I fill the placeholder values with a constant, extremely low/high elevation, and then trim them away:

Screen Shot 2020-08-24 at 7 59 47 PM

Two questions:

Screen Shot 2020-08-24 at 7 51 00 PM
mourner commented 4 years ago

Hey Peter! It's probably not worth adding to the core unless it can be done minimally (to keep the library as simple as possible), and I'm not sure how to approach it (needs to be investigated), but have you seen https://github.com/mapbox/delatin? It's much better suited for cases like this, unless you need real time hierarchical simplification on the fly.