1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! # OpenMesh
//!
//! **OpenMesh** is a Rust mesh validation library using face-vertex data structure.
//!
//! ## Quick Start
//!
//! ```
//! use openmesh::{Face, Mesh, MeshError, Vertex};
//!
//! let mesh = Mesh {
//! vertices: vec![
//! Vertex(0.0, 0.0, 0.0),
//! Vertex(1.0, 0.0, 0.0),
//! Vertex(0.0, 1.0, 0.0),
//! ],
//! faces: vec![Face(0, 1, 2)],
//! };
//!
//! assert_eq!(mesh.validate(), Err(MeshError::OpenEdges));
//! ```
//!
//! Loading mesh from file (requires feature flags `stl`, `obj`, etc.):
//!
//! ```bash
//! cargo add openmesh --features stl
//! ```
//!
//! ```ignore
//! use openmesh::Mesh;
//! use std::fs::File;
//!
//! let mut file = File::open("mesh.stl").expect("Failed to open mesh.stl");
//! let mesh: Mesh = Mesh::from_stl(&mut file).expect("Failed to load mesh.stl");
//!
//! assert!(mesh.validate().is_ok());
//! ```
//!
//! OpenMesh also supports parallelization using `rayon`:
//!
//! ```bash
//! cargo add openmesh --features rayon
//! ```
//!
//! OpenMesh can be used in `no_std` environment:
//!
//! ```bash
//! cargo add openmesh --no-default-features --features libm
//! ```
extern crate alloc;
pub use ;
pub use Face;
pub use Mesh;
pub use Vertex;