Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions crates/store/re_types/definitions/rerun/archetypes/transform3d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,28 @@ namespace rerun.archetypes;
/// E.g. if both a translation and a max3x3 transform are present,
/// the 3x3 matrix is applied first, followed by the translation.
///
/// Each transform component can be listed multiple times, but transform tree propagation is only possible
/// if there's only one instance for each transform component.
/// TODO(#6831): write more about the exact interaction with the to be written `OutOfTreeTransform` component.
///
/// \example archetypes/transform3d_simple title="Variety of 3D transforms" image="https://static.rerun.io/transform3d_simple/141368b07360ce3fcb1553079258ae3f42bdb9ac/1200w.png"
/// \example archetypes/transform3d_hierarchy title="Transform hierarchy" image="https://static.rerun.io/transform_hierarchy/cb7be7a5a31fcb2efc02ba38e434849248f87554/1200w.png"
// TODO(#6831): provide example with out of tree transform.
table Transform3D (
"attr.rust.derive": "Default, PartialEq",
"attr.rust.generate_field_info",
"attr.docs.category": "Spatial 3D",
"attr.docs.view_types": "Spatial3DView, Spatial2DView: if logged above active projection"
) {
/// Translation vectors.
translation: [rerun.components.Translation3D] ("attr.rerun.component_optional", nullable, order: 1100);
/// Translation vector.
translation: rerun.components.Translation3D ("attr.rerun.component_optional", nullable, order: 1100);

/// Rotation via axis + angle.
rotation_axis_angle: [rerun.components.RotationAxisAngle] ("attr.rerun.component_optional", nullable, order: 1200);
rotation_axis_angle: rerun.components.RotationAxisAngle ("attr.rerun.component_optional", nullable, order: 1200);

/// Rotation via quaternion.
quaternion: [rerun.components.RotationQuat] ("attr.rerun.component_optional", nullable, order: 1300);
quaternion: rerun.components.RotationQuat ("attr.rerun.component_optional", nullable, order: 1300);

/// Scaling factor.
scale: [rerun.components.Scale3D] ("attr.rerun.component_optional", nullable, order: 1400);
scale: rerun.components.Scale3D ("attr.rerun.component_optional", nullable, order: 1400);

/// 3x3 transformation matrices.
mat3x3: [rerun.components.TransformMat3x3] ("attr.rerun.component_optional", nullable, order: 1500);
/// 3x3 transformation matrix.
mat3x3: rerun.components.TransformMat3x3 ("attr.rerun.component_optional", nullable, order: 1500);

/// Specifies the relation this transform establishes between this entity and its parent.
relation: rerun.components.TransformRelation ("attr.rerun.component_optional", nullable, order: 1600);
Expand Down
133 changes: 54 additions & 79 deletions crates/store/re_types/src/archetypes/transform3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions crates/store/re_types/src/archetypes/transform3d_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ impl Transform3D {
pub fn with_rotation(self, rotation: impl Into<Rotation3D>) -> Self {
match rotation.into() {
Rotation3D::Quaternion(quaternion) => Self {
quaternion: Some(vec![quaternion]),
quaternion: Some(quaternion),
..self
},
Rotation3D::AxisAngle(rotation_axis_angle) => Self {
rotation_axis_angle: Some(vec![rotation_axis_angle]),
rotation_axis_angle: Some(rotation_axis_angle),
..self
},
}
Expand All @@ -25,7 +25,7 @@ impl Transform3D {
#[inline]
pub fn from_translation(translation: impl Into<Translation3D>) -> Self {
Self {
translation: Some(vec![translation.into()]),
translation: Some(translation.into()),
..Self::default()
}
}
Expand All @@ -34,7 +34,7 @@ impl Transform3D {
#[inline]
pub fn from_mat3x3(mat3x3: impl Into<TransformMat3x3>) -> Self {
Self {
mat3x3: Some(vec![mat3x3.into()]),
mat3x3: Some(mat3x3.into()),
..Self::default()
}
}
Expand All @@ -49,7 +49,7 @@ impl Transform3D {
#[inline]
pub fn from_scale(scale: impl Into<Scale3D>) -> Self {
Self {
scale: Some(vec![scale.into()]),
scale: Some(scale.into()),
..Self::default()
}
}
Expand All @@ -61,7 +61,7 @@ impl Transform3D {
rotation: impl Into<Rotation3D>,
) -> Self {
Self {
translation: Some(vec![translation.into()]),
translation: Some(translation.into()),
..Self::default()
}
.with_rotation(rotation)
Expand All @@ -74,8 +74,8 @@ impl Transform3D {
mat3x3: impl Into<TransformMat3x3>,
) -> Self {
Self {
mat3x3: Some(vec![mat3x3.into()]),
translation: Some(vec![translation.into()]),
mat3x3: Some(mat3x3.into()),
translation: Some(translation.into()),
..Self::default()
}
}
Expand All @@ -87,8 +87,8 @@ impl Transform3D {
scale: impl Into<Scale3D>,
) -> Self {
Self {
scale: Some(vec![scale.into()]),
translation: Some(vec![translation.into()]),
scale: Some(scale.into()),
translation: Some(translation.into()),
..Self::default()
}
}
Expand All @@ -101,8 +101,8 @@ impl Transform3D {
scale: impl Into<Scale3D>,
) -> Self {
Self {
scale: Some(vec![scale.into()]),
translation: Some(vec![translation.into()]),
scale: Some(scale.into()),
translation: Some(translation.into()),
..Self::default()
}
.with_rotation(rotation)
Expand All @@ -112,7 +112,7 @@ impl Transform3D {
#[inline]
pub fn from_rotation_scale(rotation: impl Into<Rotation3D>, scale: impl Into<Scale3D>) -> Self {
Self {
scale: Some(vec![scale.into()]),
scale: Some(scale.into()),
..Self::default()
}
.with_rotation(rotation)
Expand Down
Loading