pub struct PointCloud {
pub points: Vec<[f64; 3]>,
pub normals: Vec<[f64; 3]>,
pub colors: Vec<[f32; 3]>,
}Expand description
A collection of 3-D points with optional per-point normals and colors.
Fields§
§points: Vec<[f64; 3]>XYZ positions.
normals: Vec<[f64; 3]>Per-point surface normals (may be empty).
colors: Vec<[f32; 3]>Per-point RGB colors in [0, 1] (may be empty).
Implementations§
Source§impl PointCloud
impl PointCloud
Sourcepub fn bounding_box(&self) -> ([f64; 3], [f64; 3])
pub fn bounding_box(&self) -> ([f64; 3], [f64; 3])
Returns the axis-aligned bounding box as (min, max).
Sourcepub fn scale_uniform(&mut self, s: f64)
pub fn scale_uniform(&mut self, s: f64)
Uniformly scales all points around the origin.
Source§impl PointCloud
impl PointCloud
Sourcepub fn from_points(points: Vec<[f64; 3]>) -> Self
pub fn from_points(points: Vec<[f64; 3]>) -> Self
Constructs a PointCloud from a vec of points (expansion API).
Sourcepub fn estimate_normals_pca(&mut self, k: usize)
pub fn estimate_normals_pca(&mut self, k: usize)
Estimate per-point normals using PCA of the k nearest neighbors.
Populates self.normals.
Sourcepub fn voxel_downsample(&self, voxel_size: f64) -> Self
pub fn voxel_downsample(&self, voxel_size: f64) -> Self
Return a new downsampled cloud using a voxel grid of side voxel_size.
Sourcepub fn statistical_outlier_removal(&self, k: usize, std_ratio: f64) -> Self
pub fn statistical_outlier_removal(&self, k: usize, std_ratio: f64) -> Self
Return a new cloud with statistical outliers removed.
Source§impl PointCloud
impl PointCloud
Sourcepub fn farthest_point_sample(&self, k: usize) -> Self
pub fn farthest_point_sample(&self, k: usize) -> Self
Farthest Point Sampling: select k well-spread points from this cloud.
Returns a new PointCloud with the selected points (normals / colors are copied if present).
Sourcepub fn fit_plane_ransac(
&self,
n_iter: usize,
threshold: f64,
) -> Option<RansacPlaneResult>
pub fn fit_plane_ransac( &self, n_iter: usize, threshold: f64, ) -> Option<RansacPlaneResult>
Fit a plane to the point cloud using RANSAC.
Returns None if fewer than 3 points are present.
Sourcepub fn pca_obb(&self) -> ([[f64; 3]; 3], [f64; 3], [f64; 3])
pub fn pca_obb(&self) -> ([[f64; 3]; 3], [f64; 3], [f64; 3])
Compute the PCA-based OBB of this cloud.
Returns (principal_axes, half_extents, center).
Sourcepub fn compute_principal_curvatures(&self, k: usize) -> Vec<(f64, f64)>
pub fn compute_principal_curvatures(&self, k: usize) -> Vec<(f64, f64)>
Compute PCA-based principal curvatures for each point.
For each point a k-NN neighbourhood is gathered, the 3×3 covariance matrix is formed, and the two smallest eigenvalues (λ₁ ≤ λ₂) are returned as the approximate principal curvatures κ₁ and κ₂.
Returns a Vec<(f64, f64)> of (kappa1, kappa2) for every point.
Sourcepub fn icp_register(&self, target: &PointCloud) -> IcpResult
pub fn icp_register(&self, target: &PointCloud) -> IcpResult
Align this cloud onto target using ICP (point-to-point) and
return the registration result (rotation + translation + error).
Calls the existing IcpRegistration::align helper.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PointCloud
impl RefUnwindSafe for PointCloud
impl Send for PointCloud
impl Sync for PointCloud
impl Unpin for PointCloud
impl UnsafeUnpin for PointCloud
impl UnwindSafe for PointCloud
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.