#mesh #half-edge #graphics #3d #geometry

tri-mesh

A triangle mesh data structure including basic operations

9 releases (5 breaking)

0.6.1 Sep 2, 2024
0.6.0 Nov 2, 2022
0.5.0 Feb 29, 2020
0.4.0 Mar 14, 2019
0.1.2 Jan 16, 2019

#497 in Data structures

25 downloads per month

MIT license

215KB
5K SLoC

tri-mesh

crates.io Docs.rs Continuous integration MIT licensed

This crate contains an implementation of the half-edge data structure which represents a triangle mesh and is efficient for creating, editing, traversing and computing on that mesh. The mesh can easily be created from and exported into a format that is efficient for visualization.

This crate also contains basic functionality to safely operate on this mesh data structure and which can be used for implementing more advanced operations, for example

  • Half-edge walker to traverse the mesh
  • Iterators over primitives (vertices, half-edges, edges, faces)
  • Edit functionality (e.g. split edge, collapse edge, flip edge)

Finally, a set of more or less advanced operations is also provided, for example

  • Transformations affecting the vertex positions (e.g. moving a single vertex or rotate the entire mesh)
  • Measures on vertices, edges and faces (e.g. position of vertex, area of face)
  • Quality functionality (e.g. flip edges recursively to improve triangle quality, collapse small faces)
  • Intersection functionality (e.g. face/ray intersection, edge/point intersection)
  • Merge used for merging of entire meshes (e.g. append one mesh to another or merge overlapping primitives in a mesh)
  • Split functionality (e.g. clone a subset of a mesh or split two meshes at their intersection)

Please, see the documentation for more details.

Dependencies

~2.4–4.5MB
~80K SLoC