#mesh #3d #real-time #topology #graphics #halfedge-graph

mesh-graph

Fast halfedge triangle mesh graph in pure Rust

1 unstable release

Uses new Rust 2024

new 0.1.1 May 15, 2025
0.1.0 May 15, 2025

#594 in Algorithms


Used in freestyle-sculpt

MIT license

200KB
1.5K SLoC

Mesh Graph

Crates.io Docs MIT/Apache 2.0 Build Status

MeshGraph is a halfedge data structure for representing triangle meshes. It uses parry3d's Qbvh to implement some of parry3d's spatial queries. It also uses slotmap to manage the graph nodes.

This is heavily inspired by SMesh and OpenMesh.

Features

  • Fast spatial queries using parry3d's Qbvh
  • High performance using slotmap
  • Easy integration with Bevy game engine using the bevy Cargo feature
  • Good debugging using rerun Cargo feature to enable the Rerun integration
  • Nice documentation with illustrations

Usage

use mesh_graph::{MeshGraph, primitives::IcoSphere};

// Create a new mesh
let mesh_graph = MeshGraph::from(IcoSphere { radius: 10.0, subdivisions: 2 });

// Get some vertex ID and its vertex node
let (vertex_id, vertex) = mesh_graph.vertices.iter().next().unwrap();

// Iterate over all outgoing halfedges of the vertex
for halfedge_id in vertex.outgoing_halfedges(&mesh_graph) {
    // do sth
}

// Get the position of the vertex
let position = mesh_graph.positions[vertex_id];

Check out the crate freestyle-sculpt for a heavy duty example.

Connectivity

Halfedge

Connectivity

Vertex

Connectivity

Dependencies

~13–50MB
~862K SLoC