axiolid_tessellation_contract/
tessellator.rs

1//! Graph tessellation capability.
2
3use axiolid_model::{GeometryGraph, NodeId};
4
5use crate::{TessellatedMesh, TessellationOptions};
6
7/// Convert exact graph nodes to watertight triangle meshes.
8pub trait Tessellator: core::fmt::Debug + Send + Sync {
9    /// Structured failure.
10    type Error: std::error::Error + Send + Sync + 'static;
11
12    /// Tessellate one node.
13    fn tessellate(
14        &self,
15        graph: &GeometryGraph,
16        root: NodeId,
17        options: &TessellationOptions,
18    ) -> Result<TessellatedMesh, Self::Error>;
19
20    /// Tessellate many roots. Implementations should override for parallel/GPU
21    /// batching and must preserve input order.
22    fn tessellate_batch(
23        &self,
24        graph: &GeometryGraph,
25        roots: &[NodeId],
26        options: &TessellationOptions,
27    ) -> Result<Vec<TessellatedMesh>, Self::Error> {
28        roots
29            .iter()
30            .map(|&root| self.tessellate(graph, root, options))
31            .collect()
32    }
33}