Skip to main content

label_components

Function label_components 

Source
pub fn label_components(
    face_count: u32,
    half_edges: &[HalfEdge],
    labels: &mut [u32],
    queue: &mut [u32],
) -> Result<u32, ConnectivityError>
Expand description

Label connected components by BFS over the face-adjacency graph.

Two faces are in the same component if connected by a path of twin-linked half-edges. labels[f] receives the component index (0-based, assigned in ascending face-index order of first encounter). queue is a workspace buffer of length face_count.

Returns the number of connected components.

Zero-heap. Deterministic.