pub struct OrganizedPointCloud<T> {
pub width: usize,
pub height: usize,
pub points: Vec<Option<T>>,
pub is_dense: bool,
}Expand description
A point cloud whose points sit in a width × height grid in row-major order.
Cells holding None represent missing returns. Iteration via
OrganizedPointCloud::iter_valid yields only the populated cells.
Fields§
§width: usizePoints per row.
height: usizeNumber of rows (LiDAR rings or image rows).
points: Vec<Option<T>>Row-major storage of length width * height.
is_dense: booltrue iff every cell is Some. Mirrors sensor_msgs/PointCloud2::is_dense.
Implementations§
Source§impl<T> OrganizedPointCloud<T>
impl<T> OrganizedPointCloud<T>
Sourcepub fn new(width: usize, height: usize) -> Selfwhere
T: Clone,
pub fn new(width: usize, height: usize) -> Selfwhere
T: Clone,
Create an empty organized cloud with the given dimensions; every cell
starts as None and is_dense = false.
Sourcepub fn from_points(
width: usize,
height: usize,
points: Vec<Option<T>>,
) -> Option<Self>
pub fn from_points( width: usize, height: usize, points: Vec<Option<T>>, ) -> Option<Self>
Construct from a flat row-major buffer of Option<T>.
Returns None if points.len() != width * height.
Sourcepub fn valid_count(&self) -> usize
pub fn valid_count(&self) -> usize
Number of Some cells.
Sourcepub fn get(&self, row: usize, col: usize) -> Option<&T>
pub fn get(&self, row: usize, col: usize) -> Option<&T>
Borrow the point at (row, col), if any. Returns None for both
out-of-bounds indices and empty cells.
Sourcepub fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut T>
pub fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut T>
Mutable borrow of the point at (row, col).
Sourcepub fn set(&mut self, row: usize, col: usize, value: Option<T>) -> bool
pub fn set(&mut self, row: usize, col: usize, value: Option<T>) -> bool
Set a point at (row, col). Returns false if the indices are out of bounds.
Updates is_dense conservatively (set to false whenever a None is written).
Sourcepub fn row(&self, row: usize) -> &[Option<T>]
pub fn row(&self, row: usize) -> &[Option<T>]
Slice of all cells in the given row (out-of-bounds → empty slice).
Sourcepub fn ring(&self, ring_index: usize) -> &[Option<T>]
pub fn ring(&self, ring_index: usize) -> &[Option<T>]
Alias for [row] — LiDAR users typically call rows “rings”.
Sourcepub fn iter_valid(&self) -> impl Iterator<Item = (usize, usize, &T)>
pub fn iter_valid(&self) -> impl Iterator<Item = (usize, usize, &T)>
Iterator over (row, col, &T) for all populated cells.
Sourcepub fn refresh_dense_flag(&mut self)
pub fn refresh_dense_flag(&mut self)
Recompute is_dense from the current cell contents.
Source§impl<T: Clone> OrganizedPointCloud<T>
impl<T: Clone> OrganizedPointCloud<T>
Sourcepub fn to_unorganized(&self) -> PointCloud<T>
pub fn to_unorganized(&self) -> PointCloud<T>
Drop None cells and return an unorganized cloud preserving point order.
Source§impl OrganizedPointCloud<Point3f>
impl OrganizedPointCloud<Point3f>
Sourcepub fn from_depth_image(
depth: &[u16],
width: usize,
height: usize,
intrinsics: &CameraIntrinsics,
depth_scale: f32,
) -> Option<Self>
pub fn from_depth_image( depth: &[u16], width: usize, height: usize, intrinsics: &CameraIntrinsics, depth_scale: f32, ) -> Option<Self>
Build an organized cloud by back-projecting a row-major depth image
through pinhole intrinsics. Pixels with a depth of 0 (or NaN after
scaling) are stored as None.
Returns None if depth.len() != width * height.
Trait Implementations§
Source§impl<T: Clone> Clone for OrganizedPointCloud<T>
impl<T: Clone> Clone for OrganizedPointCloud<T>
Source§fn clone(&self) -> OrganizedPointCloud<T>
fn clone(&self) -> OrganizedPointCloud<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Debug> Debug for OrganizedPointCloud<T>
impl<T: Debug> Debug for OrganizedPointCloud<T>
Source§impl<T> Default for OrganizedPointCloud<T>
impl<T> Default for OrganizedPointCloud<T>
Source§impl<'de, T> Deserialize<'de> for OrganizedPointCloud<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for OrganizedPointCloud<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl<T> Freeze for OrganizedPointCloud<T>
impl<T> RefUnwindSafe for OrganizedPointCloud<T>where
T: RefUnwindSafe,
impl<T> Send for OrganizedPointCloud<T>where
T: Send,
impl<T> Sync for OrganizedPointCloud<T>where
T: Sync,
impl<T> Unpin for OrganizedPointCloud<T>where
T: Unpin,
impl<T> UnsafeUnpin for OrganizedPointCloud<T>
impl<T> UnwindSafe for OrganizedPointCloud<T>where
T: UnwindSafe,
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.