Struct rerun::sdk::prelude::InstancePoses3D
source · pub struct InstancePoses3D {
pub translations: Option<Vec<PoseTranslation3D>>,
pub rotation_axis_angles: Option<Vec<PoseRotationAxisAngle>>,
pub quaternions: Option<Vec<PoseRotationQuat>>,
pub scales: Option<Vec<PoseScale3D>>,
pub mat3x3: Option<Vec<PoseTransformMat3x3>>,
}
Expand description
Archetype: One or more transforms between the current entity and its parent. Unlike archetypes::Transform3D
, it is not propagated in the transform hierarchy.
If both archetypes::InstancePoses3D
and archetypes::Transform3D
are present,
first the tree propagating archetypes::Transform3D
is applied, then archetypes::InstancePoses3D
.
From the point of view of the entity’s coordinate system, all components are applied in the inverse order they are listed here. E.g. if both a translation and a max3x3 transform are present, the 3x3 matrix is applied first, followed by the translation.
Currently, many visualizers support only a single instance transform per entity.
Check archetype documentations for details - if not otherwise specified, only the first instance transform is applied.
Some visualizers like the mesh visualizer used for [archetype.Mesh3D
],
will draw an object for every pose, a behavior also known as “instancing”.
§Example
§Regular & instance transforms in tandem
use rerun::{
demo_util::grid,
external::{anyhow, glam},
};
fn main() -> anyhow::Result<()> {
let rec =
rerun::RecordingStreamBuilder::new("rerun_example_instance_pose3d_combined").spawn()?;
rec.set_time_sequence("frame", 0);
// Log a box and points further down in the hierarchy.
rec.log(
"world/box",
&rerun::Boxes3D::from_half_sizes([[1.0, 1.0, 1.0]]),
)?;
rec.log(
"world/box/points",
&rerun::Points3D::new(grid(glam::Vec3::splat(-10.0), glam::Vec3::splat(10.0), 10)),
)?;
for i in 0..180 {
rec.set_time_sequence("frame", i);
// Log a regular transform which affects both the box and the points.
rec.log(
"world/box",
&rerun::Transform3D::from_rotation(rerun::RotationAxisAngle {
axis: [0.0, 0.0, 1.0].into(),
angle: rerun::Angle::from_degrees(i as f32 * 2.0),
}),
)?;
// Log an instance pose which affects only the box.
let translation = [0.0, 0.0, (i as f32 * 0.1 - 5.0).abs() - 5.0];
rec.log(
"world/box",
&rerun::InstancePoses3D::new().with_translations([translation]),
)?;
}
Ok(())
}
Fields§
§translations: Option<Vec<PoseTranslation3D>>
Translation vectors.
rotation_axis_angles: Option<Vec<PoseRotationAxisAngle>>
Rotations via axis + angle.
quaternions: Option<Vec<PoseRotationQuat>>
Rotations via quaternion.
scales: Option<Vec<PoseScale3D>>
Scaling factors.
mat3x3: Option<Vec<PoseTransformMat3x3>>
3x3 transformation matrices.
Implementations§
source§impl InstancePoses3D
impl InstancePoses3D
sourcepub const NUM_COMPONENTS: usize = 6usize
pub const NUM_COMPONENTS: usize = 6usize
The total number of components in the archetype: 0 required, 1 recommended, 5 optional
source§impl InstancePoses3D
impl InstancePoses3D
sourcepub fn new() -> InstancePoses3D
pub fn new() -> InstancePoses3D
Create a new InstancePoses3D
.
sourcepub fn with_translations(
self,
translations: impl IntoIterator<Item = impl Into<PoseTranslation3D>>
) -> InstancePoses3D
pub fn with_translations( self, translations: impl IntoIterator<Item = impl Into<PoseTranslation3D>> ) -> InstancePoses3D
Translation vectors.
sourcepub fn with_rotation_axis_angles(
self,
rotation_axis_angles: impl IntoIterator<Item = impl Into<PoseRotationAxisAngle>>
) -> InstancePoses3D
pub fn with_rotation_axis_angles( self, rotation_axis_angles: impl IntoIterator<Item = impl Into<PoseRotationAxisAngle>> ) -> InstancePoses3D
Rotations via axis + angle.
sourcepub fn with_quaternions(
self,
quaternions: impl IntoIterator<Item = impl Into<PoseRotationQuat>>
) -> InstancePoses3D
pub fn with_quaternions( self, quaternions: impl IntoIterator<Item = impl Into<PoseRotationQuat>> ) -> InstancePoses3D
Rotations via quaternion.
sourcepub fn with_scales(
self,
scales: impl IntoIterator<Item = impl Into<PoseScale3D>>
) -> InstancePoses3D
pub fn with_scales( self, scales: impl IntoIterator<Item = impl Into<PoseScale3D>> ) -> InstancePoses3D
Scaling factors.
sourcepub fn with_mat3x3(
self,
mat3x3: impl IntoIterator<Item = impl Into<PoseTransformMat3x3>>
) -> InstancePoses3D
pub fn with_mat3x3( self, mat3x3: impl IntoIterator<Item = impl Into<PoseTransformMat3x3>> ) -> InstancePoses3D
3x3 transformation matrices.
Trait Implementations§
source§impl Archetype for InstancePoses3D
impl Archetype for InstancePoses3D
§type Indicator = GenericIndicatorComponent<InstancePoses3D>
type Indicator = GenericIndicatorComponent<InstancePoses3D>
source§fn name() -> ArchetypeName
fn name() -> ArchetypeName
rerun.archetypes.Points2D
.source§fn display_name() -> &'static str
fn display_name() -> &'static str
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>)>
) -> Result<InstancePoses3D, DeserializationError>
fn from_arrow_components( arrow_data: impl IntoIterator<Item = (ComponentName, Box<dyn Array>)> ) -> Result<InstancePoses3D, DeserializationError>
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 InstancePoses3D
impl AsComponents for InstancePoses3D
source§fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
fn as_component_batches(&self) -> Vec<MaybeOwnedComponentBatch<'_>>
ComponentBatch
s. Read moresource§impl Clone for InstancePoses3D
impl Clone for InstancePoses3D
source§fn clone(&self) -> InstancePoses3D
fn clone(&self) -> InstancePoses3D
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for InstancePoses3D
impl Debug for InstancePoses3D
source§impl PartialEq for InstancePoses3D
impl PartialEq for InstancePoses3D
source§fn eq(&self, other: &InstancePoses3D) -> bool
fn eq(&self, other: &InstancePoses3D) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl SizeBytes for InstancePoses3D
impl SizeBytes for InstancePoses3D
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 ArchetypeReflectionMarker for InstancePoses3D
impl StructuralPartialEq for InstancePoses3D
Auto Trait Implementations§
impl Freeze for InstancePoses3D
impl RefUnwindSafe for InstancePoses3D
impl Send for InstancePoses3D
impl Sync for InstancePoses3D
impl Unpin for InstancePoses3D
impl UnwindSafe for InstancePoses3D
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> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request