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>>,
pub instance_keys: Option<Vec<InstanceKey>>,
}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
//! Log some random points with color and radii.
use rand::{distributions::Uniform, Rng as _};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let (rec, storage) =
rerun::RecordingStreamBuilder::new("rerun_example_points3d_random").memory()?;
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>())),
)?;
rerun::native_viewer::show(storage.take())?;
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.
instance_keys: Option<Vec<InstanceKey>>Unique identifiers for each individual point in the batch.
Implementations§
source§impl Points3D
impl Points3D
pub fn new(positions: impl IntoIterator<Item = impl Into<Position3D>>) -> Self
pub fn with_radii( self, radii: impl IntoIterator<Item = impl Into<Radius>> ) -> Self
pub fn with_colors( self, colors: impl IntoIterator<Item = impl Into<Color>> ) -> Self
pub fn with_labels( self, labels: impl IntoIterator<Item = impl Into<Text>> ) -> Self
pub fn with_class_ids( self, class_ids: impl IntoIterator<Item = impl Into<ClassId>> ) -> Self
pub fn with_keypoint_ids( self, keypoint_ids: impl IntoIterator<Item = impl Into<KeypointId>> ) -> Self
pub fn with_instance_keys( self, instance_keys: impl IntoIterator<Item = impl Into<InstanceKey>> ) -> Self
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(
arrow_data: impl IntoIterator<Item = (Field, Box<dyn Array>)>
) -> DeserializationResult<Self>
fn from_arrow( arrow_data: impl IntoIterator<Item = (Field, Box<dyn Array>)> ) -> DeserializationResult<Self>
source§impl AsComponents for Points3D
impl AsComponents for Points3D
source§fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
ComponentBatchs. Read more