axiolid_tessellation_contract/output.rs
1//! Discrete geometry plus the tolerance that produced it.
2
3use axiolid_core::Tolerance;
4use axiolid_mesh::TriMesh;
5
6/// A triangle mesh with immutable approximation provenance.
7///
8/// The wrapper prevents a generated mesh from becoming tolerance-free currency
9/// between operations. Callers can still recover the representation explicitly
10/// with [`Self::into_mesh`].
11#[derive(Debug, Clone, PartialEq)]
12pub struct TessellatedMesh {
13 mesh: TriMesh,
14 tolerance: Tolerance,
15}
16
17impl TessellatedMesh {
18 /// Bind a produced mesh to the tolerance used to create it.
19 #[must_use]
20 pub const fn new(mesh: TriMesh, tolerance: Tolerance) -> Self {
21 Self { mesh, tolerance }
22 }
23
24 /// Borrow the triangle representation.
25 #[must_use]
26 pub const fn mesh(&self) -> &TriMesh {
27 &self.mesh
28 }
29
30 /// Approximation tolerance used to produce the mesh.
31 #[must_use]
32 pub const fn tolerance(&self) -> Tolerance {
33 self.tolerance
34 }
35
36 /// Consume the artifact and recover its triangle representation.
37 #[must_use]
38 pub fn into_mesh(self) -> TriMesh {
39 self.mesh
40 }
41}