delatin 0.2.1

Fast TIN generation using Delaunay triangulation.
Documentation
  • Coverage
  • 42.86%
    3 out of 7 items documented1 out of 3 items with examples
  • Size
  • Source code size: 33.69 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.18 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • pokhanto/delatin-rs
    8 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • pokhanto

delatin-rs

Simple and fast TIN generation library, written in Rust. Uses Delaunay triangulation.

Result of triangulation

Delatin is a port of Volodymyr Agafonkin's delatin (JavaScript) and Michael Fogleman's hmm (C++), which is in turn based on the paper Fast Polygonal Approximation of Terrains and Height Fields (1995) by Michael Garland and Paul Heckbert.

Example

use delatin::{triangulate, Error};

let heights = vec![100.1, 123.4, 111.5, 121.4];
let width = 2;
let height = 2;
let max_error = Error(1.0);
// points `Vec<(usize, usize)>`: A vector containing all the vertices of the triangulated mesh. Each point corresponds to heights vector index.
// triangles `Vec<(usize, usize, usize)>`: A vector containing all the triangles of the mesh, each defined by indices into the `points`.
let (points, triangles) = triangulate(&heights, width, height, max_error)?;

Installation

cargo add delatin

Plot triangulation result

Align your data in plot/src/main.rs and run:

cargo run --bin plot

Benchmark test

cargo run --bin test --release

TODO

  • Add tests
  • Add benchmarks
  • Add more comments and docs