Struct re_types::archetypes::Points3D
source · pub struct Points3D {
pub positions: Vec<Position3D>,
pub radii: Option<Vec<Radius>>,
pub colors: Option<Vec<Color>>,
pub labels: Option<Vec<Text>>,
pub class_ids: Option<Vec<ClassId>>,
pub keypoint_ids: Option<Vec<KeypointId>>,
}
Expand description
Archetype: A 3D point cloud with positions and optional colors, radii, labels, etc.
§Example
§Randomly distributed 3D points with varying color and radius
use rand::{distributions::Uniform, Rng as _};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_points3d_random").spawn()?;
let mut rng = rand::thread_rng();
let dist = Uniform::new(-5., 5.);
rec.log(
"random",
&rerun::Points3D::new(
(0..10).map(|_| (rng.sample(dist), rng.sample(dist), rng.sample(dist))),
)
.with_colors((0..10).map(|_| rerun::Color::from_rgb(rng.gen(), rng.gen(), rng.gen())))
.with_radii((0..10).map(|_| rng.gen::<f32>())),
)?;
Ok(())
}
Fields§
§positions: Vec<Position3D>
All the 3D positions at which the point cloud shows points.
radii: Option<Vec<Radius>>
Optional radii for the points, effectively turning them into circles.
colors: Option<Vec<Color>>
Optional colors for the points.
labels: Option<Vec<Text>>
Optional text labels for the points.
class_ids: Option<Vec<ClassId>>
Optional class Ids for the points.
The class ID provides colors and labels if not specified explicitly.
keypoint_ids: Option<Vec<KeypointId>>
Optional keypoint IDs for the points, identifying them within a class.
If keypoint IDs are passed in but no class IDs were specified, the class ID will
default to 0.
This is useful to identify points within a single classification (which is identified
with class_id
).
E.g. the classification might be ‘Person’ and the keypoints refer to joints on a
detected skeleton.
Implementations§
source§impl Points3D
impl Points3D
sourcepub const NUM_COMPONENTS: usize = 7usize
pub const NUM_COMPONENTS: usize = 7usize
The total number of components in the archetype: 1 required, 3 recommended, 3 optional
source§impl Points3D
impl Points3D
sourcepub fn new(positions: impl IntoIterator<Item = impl Into<Position3D>>) -> Self
pub fn new(positions: impl IntoIterator<Item = impl Into<Position3D>>) -> Self
Create a new Points3D
.
sourcepub fn with_radii(
self,
radii: impl IntoIterator<Item = impl Into<Radius>>
) -> Self
pub fn with_radii( self, radii: impl IntoIterator<Item = impl Into<Radius>> ) -> Self
Optional radii for the points, effectively turning them into circles.
sourcepub fn with_colors(
self,
colors: impl IntoIterator<Item = impl Into<Color>>
) -> Self
pub fn with_colors( self, colors: impl IntoIterator<Item = impl Into<Color>> ) -> Self
Optional colors for the points.
sourcepub fn with_labels(
self,
labels: impl IntoIterator<Item = impl Into<Text>>
) -> Self
pub fn with_labels( self, labels: impl IntoIterator<Item = impl Into<Text>> ) -> Self
Optional text labels for the points.
sourcepub fn with_class_ids(
self,
class_ids: impl IntoIterator<Item = impl Into<ClassId>>
) -> Self
pub fn with_class_ids( self, class_ids: impl IntoIterator<Item = impl Into<ClassId>> ) -> Self
Optional class Ids for the points.
The class ID provides colors and labels if not specified explicitly.
sourcepub fn with_keypoint_ids(
self,
keypoint_ids: impl IntoIterator<Item = impl Into<KeypointId>>
) -> Self
pub fn with_keypoint_ids( self, keypoint_ids: impl IntoIterator<Item = impl Into<KeypointId>> ) -> Self
Optional keypoint IDs for the points, identifying them within a class.
If keypoint IDs are passed in but no class IDs were specified, the class ID will
default to 0.
This is useful to identify points within a single classification (which is identified
with class_id
).
E.g. the classification might be ‘Person’ and the keypoints refer to joints on a
detected skeleton.
source§impl Points3D
impl Points3D
sourcepub fn from_file_path(filepath: &Path) -> Result<Self>
pub fn from_file_path(filepath: &Path) -> Result<Self>
Creates a new Points3D
from a .ply
file.
§Supported properties
This expects the following property names:
- (Required) Positions of the points:
"x"
,"y"
&"z"
. - (Optional) Colors of the points:
"red"
,"green"
&"blue"
. - (Optional) Radii of the points:
"radius"
. - (Optional) Labels of the points:
"label"
.
The media type will be inferred from the path (extension), or the contents if that fails.
sourcepub fn from_file_contents(contents: &[u8]) -> Result<Self>
pub fn from_file_contents(contents: &[u8]) -> Result<Self>
Creates a new Points3D
from the contents of a .ply
file.
If unspecified, he media type will be inferred from the contents.
Trait Implementations§
source§impl Archetype for Points3D
impl Archetype for Points3D
§type Indicator = GenericIndicatorComponent<Points3D>
type Indicator = GenericIndicatorComponent<Points3D>
source§fn name() -> ArchetypeName
fn name() -> ArchetypeName
rerun.archetypes.Points2D
.source§fn indicator() -> MaybeOwnedComponentBatch<'static>
fn indicator() -> MaybeOwnedComponentBatch<'static>
source§fn required_components() -> Cow<'static, [ComponentName]>
fn required_components() -> Cow<'static, [ComponentName]>
source§fn recommended_components() -> Cow<'static, [ComponentName]>
fn recommended_components() -> Cow<'static, [ComponentName]>
source§fn optional_components() -> Cow<'static, [ComponentName]>
fn optional_components() -> Cow<'static, [ComponentName]>
source§fn all_components() -> Cow<'static, [ComponentName]>
fn all_components() -> Cow<'static, [ComponentName]>
source§fn from_arrow_components(
arrow_data: impl IntoIterator<Item = (ComponentName, Box<dyn Array>)>
) -> DeserializationResult<Self>
fn from_arrow_components( arrow_data: impl IntoIterator<Item = (ComponentName, Box<dyn Array>)> ) -> DeserializationResult<Self>
ComponentNames
, deserializes them
into this archetype. Read moresource§fn from_arrow(
data: impl IntoIterator<Item = (Field, Box<dyn Array>)>
) -> Result<Self, DeserializationError>where
Self: Sized,
fn from_arrow(
data: impl IntoIterator<Item = (Field, Box<dyn Array>)>
) -> Result<Self, DeserializationError>where
Self: Sized,
source§impl AsComponents for Points3D
impl AsComponents for Points3D
source§fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
ComponentBatch
s. Read moresource§impl PartialEq for Points3D
impl PartialEq for Points3D
source§impl SizeBytes for Points3D
impl SizeBytes for Points3D
source§fn heap_size_bytes(&self) -> u64
fn heap_size_bytes(&self) -> u64
self
on the heap, in bytes.source§fn total_size_bytes(&self) -> u64
fn total_size_bytes(&self) -> u64
self
in bytes, accounting for both stack and heap space.source§fn stack_size_bytes(&self) -> u64
fn stack_size_bytes(&self) -> u64
self
on the stack, in bytes. Read moreimpl StructuralPartialEq for Points3D
Auto Trait Implementations§
impl Freeze for Points3D
impl RefUnwindSafe for Points3D
impl Send for Points3D
impl Sync for Points3D
impl Unpin for Points3D
impl UnwindSafe for Points3D
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more