Skip to main content

OrganizedPointCloud

Struct OrganizedPointCloud 

Source
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: usize

Points per row.

§height: usize

Number of rows (LiDAR rings or image rows).

§points: Vec<Option<T>>

Row-major storage of length width * height.

§is_dense: bool

true iff every cell is Some. Mirrors sensor_msgs/PointCloud2::is_dense.

Implementations§

Source§

impl<T> OrganizedPointCloud<T>

Source

pub fn new(width: usize, height: usize) -> Self
where T: Clone,

Create an empty organized cloud with the given dimensions; every cell starts as None and is_dense = false.

Source

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.

Source

pub fn len(&self) -> usize

Total number of grid cells (width * height), including empty ones.

Source

pub fn is_empty(&self) -> bool

true iff the grid has no cells.

Source

pub fn valid_count(&self) -> usize

Number of Some cells.

Source

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.

Source

pub fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut T>

Mutable borrow of the point at (row, col).

Source

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).

Source

pub fn row(&self, row: usize) -> &[Option<T>]

Slice of all cells in the given row (out-of-bounds → empty slice).

Source

pub fn ring(&self, ring_index: usize) -> &[Option<T>]

Alias for [row] — LiDAR users typically call rows “rings”.

Source

pub fn iter_valid(&self) -> impl Iterator<Item = (usize, usize, &T)>

Iterator over (row, col, &T) for all populated cells.

Source

pub fn refresh_dense_flag(&mut self)

Recompute is_dense from the current cell contents.

Source§

impl<T: Clone> OrganizedPointCloud<T>

Source

pub fn to_unorganized(&self) -> PointCloud<T>

Drop None cells and return an unorganized cloud preserving point order.

Source§

impl OrganizedPointCloud<Point3f>

Source

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>

Source§

fn clone(&self) -> OrganizedPointCloud<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for OrganizedPointCloud<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for OrganizedPointCloud<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

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>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T> Serialize for OrganizedPointCloud<T>
where T: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,