Skip to main content

orient_normals_consistent

Function orient_normals_consistent 

Source
pub fn orient_normals_consistent(
    cloud: &mut PointCloud<NormalPoint3f>,
    k: usize,
) -> Result<()>
Expand description

Flip normals so neighbouring normals agree, all the way around the object.

estimate_normals points every normal toward one viewpoint, which is right for a single scan but leaves about half the normals of a closed object pointing inward. This walks a minimum spanning tree over the k nearest neighbours, preferring nearly parallel pairs, and flips each normal to agree with the one it was reached from (Hoppe et al. 1992). Each connected piece starts from its highest point, whose normal is turned upward, so closed objects end up with outward normals. Positions are not changed.