Function estimate_normals

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

Estimate normals for a point cloud using k-nearest neighbors

This function computes surface normals for each point in the cloud by:

  1. Finding k nearest neighbors for each point (or neighbors within radius)
  2. Computing the normal using Principal Component Analysis (PCA)
  3. The normal is the eigenvector corresponding to the smallest eigenvalue
  4. Optionally enforcing orientation consistency towards a viewpoint

§Arguments

  • cloud - Reference to the point cloud
  • k - Number of nearest neighbors to use (typically 10-30)

§Returns

  • Result<PointCloud<NormalPoint3f>> - A new point cloud with normals