Skip to main content

axiolid_mesh/
polygon.rs

1//! Polygonal face mesh that preserves n-gons and inner voids before triangulation.
2
3use axiolid_core::Point3;
4
5/// One polygonal face with an outer loop and zero or more inner loops.
6#[derive(Debug, Clone, Default, PartialEq, Eq)]
7#[cfg_attr(
8    feature = "serde",
9    derive(serde::Serialize, serde::Deserialize),
10    serde(deny_unknown_fields)
11)]
12pub struct PolygonFace {
13    /// Outer boundary position indices.
14    pub outer: Vec<u32>,
15    /// Inner boundary position indices.
16    pub holes: Vec<Vec<u32>>,
17}
18
19/// Indexed polygon mesh in local coordinates.
20#[derive(Debug, Clone, Default, PartialEq)]
21#[cfg_attr(
22    feature = "serde",
23    derive(serde::Serialize, serde::Deserialize),
24    serde(deny_unknown_fields)
25)]
26pub struct PolygonMesh {
27    /// Shared position list.
28    pub positions: Vec<Point3>,
29    /// Faces in source order.
30    pub faces: Vec<PolygonFace>,
31}