Struct PointCloud

Source
pub struct PointCloud {
    pub positions: Vec<Vec3>,
    pub colors: Option<Vec<[f32; 3]>>,
}
Expand description

Decoded points of one node, in the node’s local coordinates.

Fields§

§positions: Vec<Vec3>

Point positions.

§colors: Option<Vec<[f32; 3]>>

One linear RGB colour in 0..=1 per position, when the source has colours.

Implementations§

Source§

impl PointCloud

Source

pub fn len(&self) -> usize

Number of points.

Source

pub fn is_empty(&self) -> bool

Whether the cloud has no points.

Source

pub fn from_attributes<A: Attributes + ?Sized>( attributes: &A, ) -> Result<Option<Self>, DecodeError>

Decodes the node’s point cloud, or None when it has no point-cloud attribute. With several, pcd::base64 wins over points::array, which wins over points::base64, as in the upstream viewer.

Source

pub fn from_points_array(value: &Value) -> Result<Self, DecodeError>

Decodes a points::array value: {"positions": [[x, y, z], …], "colors": [[r, g, b], …]} with colors optional.

Source

pub fn from_points_base64(value: &Value) -> Result<Self, DecodeError>

Decodes a points::base64 value: {"positions": "<base64>", "colors": "<base64>"} with colors optional. Each string holds little-endian f32 triples back to back.

Source

pub fn from_pcd_base64(value: &Value) -> Result<Self, DecodeError>

Decodes a pcd::base64 value: a string holding a base64-encoded PCD file. See PointCloud::from_pcd.

Source

pub fn from_pcd(bytes: &[u8]) -> Result<Self, DecodeError>

Reads a PCD v0.7 file the way three.js PCDLoader r171 does.

  • DATA ascii, binary (row-major), and binary_compressed (LZF, column-major) are read. Other DATA values are DecodeError::UnsupportedPcd.
  • x, y, z are required. In binary data they must be SIZE 4, TYPE F, COUNT 1, the only layout the loader reads correctly.
  • rgb is optional, packed as 0x00RRGGBB in four bytes, and converted from sRGB to linear. In ASCII data a TYPE F value is reinterpreted bit for bit, as PCL writes it.
  • Other fields (normals, intensity, label, …) are skipped.
  • Multi-byte binary values are little-endian.

Trait Implementations§

Source§

impl Clone for PointCloud

Source§

fn clone(&self) -> PointCloud

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PointCloud

Source§

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

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

impl Default for PointCloud

Source§

fn default() -> PointCloud

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

impl PartialEq for PointCloud

Source§

fn eq(&self, other: &PointCloud) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for PointCloud

Auto Trait Implementations§

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