tri-mesh

A triangle mesh data structure including basic operations.

Why another triangle mesh data structure crate you might ask. Well, if you want a more feature complete crate than halfedgemesh and a less generic crate than plexus, then tri-mesh is probably something for you!

toml [dependencies] tri-mesh = "0.1.0"

Features

Please, see the documentation for more details.

Usage

```rust use tri_mesh::prelude::*;

fn main() { // Construct a mesh from positions and indices let indices: Vec = vec![0, 1, 2, 0, 2, 3, 0, 3, 1]; let positions: Vec = vec![0.0, 0.0, 0.0, 1.0, 0.0, -0.5, -1.0, 0.0, -0.5, 0.0, 0.0, 1.0]; let mesh = MeshBuilder::new().withindices(indices).withpositions(positions).build().unwrap();

// Compute the extreme coordinates..
let mut min_coordinates = vec3(std::f32::MAX, std::f32::MAX, std::f32::MAX);
let mut max_coordinates = vec3(std::f32::MIN, std::f32::MIN, std::f32::MIN);
for vertex_id in mesh.vertex_iter()
{
    let position = mesh.vertex_position(vertex_id);
    for i in 0..3 {
        min_coordinates[i] = min_coordinates[i].min(position[i]);
        max_coordinates[i] = max_coordinates[i].max(position[i]);
    }
}

// .. or use the built-in method
let (min_coordinates, max_coordinates) = mesh.extreme_coordinates();

} ```

Please, see the documentation for more examples.