Skip to main content

Crate martini

Crate martini 

Source
Expand description

RTIN mesh generation for terrain data based on the Martini algorithm.

This crate implements the RTIN (Right-Triangulated Irregular Network) mesh generation algorithm, which creates level-of-detail terrain meshes from heightmap data.

§References

§Example

use martini::Martini;

// Create a Martini instance for a 257x257 grid (2^8 + 1)
let mut martini = Martini::new(257);

// Create terrain from height data
let terrain = vec![0.0f64; 257 * 257];
let tile = martini.create_terrain(|x, y| terrain[y * 257 + x]);

// Generate mesh with maximum error threshold
let (vertices, indices, uvs) = tile.construct_mesh(&mut martini, 10.0, &mut |(u, v)| {
    (u, v, 0.0)
});

Structs§

Martini
Martini terrain mesh generator.
Tile
A terrain tile with pre-computed error values.

Type Aliases§

FloatType
Float type used for height values and error calculations.