Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce TransformRelation component #6944

Merged
merged 14 commits into from
Jul 22, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ namespace rerun.archetypes;

/// A transform between two 3D spaces, i.e. a pose.
///
/// All components are applied in the inverse order they are listed here.
/// E.g. if both a 4x4 matrix with a translation and a translation vector are present,
/// the translation is applied first, followed by the matrix.
/// 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.
///
/// 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.
Expand All @@ -20,10 +21,6 @@ table Transform3D (
"attr.docs.category": "Spatial 3D",
"attr.docs.view_types": "Spatial3DView, Spatial2DView: if logged above active projection"
) {
/// The transform
// TODO(#6831): remove.
transform: rerun.components.Transform3D ("attr.rerun.component_optional", order: 1000);

/// Translation vectors.
translation: [rerun.components.Translation3D] ("attr.rerun.component_optional", nullable, order: 1100);

Expand All @@ -39,6 +36,9 @@ table Transform3D (
/// 3x3 transformation matrices.
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);

// --- visual representation

/// Visual length of the 3 axes.
Expand Down
1 change: 1 addition & 0 deletions crates/store/re_types/definitions/rerun/components.fbs

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

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ namespace rerun.components;
/// The innermost datatype of an image.
///
/// How individual color channel components are encoded.
enum ChannelDataType: byte {
enum ChannelDataType: byte (
"attr.docs.unreleased"
) {
/// 8-bit unsigned integer.
U8 (default),

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace rerun.components;

/// Specifies relation a spatial transform describes.
enum TransformRelation: byte (
"attr.docs.unreleased"
) {
/// The transform describes how to transform into the parent entity's space.
///
/// E.g. a translation of (0, 1, 0) with this `TransformRelation` logged at `parent/child` means
/// that from the point of view of `parent`, `parent/child` is translated 1 unit along `parent`'s Y axis.
/// From perspective of `parent/child`, the `parent` entity is translated -1 unit along `parent/child`'s Y axis.
ParentFromChild(default),

/// The transform describes how to transform into the child entity's space.
///
/// E.g. a translation of (0, 1, 0) with this `TransformRelation` logged at `parent/child` means
/// that from the point of view of `parent`, `parent/child` is translated -1 unit along `parent`'s Y axis.
/// From perspective of `parent/child`, the `parent` entity is translated 1 unit along `parent/child`'s Y axis.
ChildFromParent,
}
70 changes: 40 additions & 30 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.

14 changes: 9 additions & 5 deletions crates/store/re_types/src/archetypes/transform3d_ext.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
components::{Scale3D, TransformMat3x3, Translation3D},
components::{Scale3D, TransformMat3x3, TransformRelation, Translation3D},
Rotation3D,
};

Expand Down Expand Up @@ -119,11 +119,15 @@ impl Transform3D {
}

/// Indicate that this transform is from parent to child.
/// This is the oppositve of the default, which is from child to parent.
///
/// This is the opposite of the default, which is from child to parent.
#[allow(clippy::wrong_self_convention)]
#[inline]
pub fn from_parent(mut self) -> Self {
self.transform = self.transform.from_parent();
self
#[deprecated(
since = "0.18.0",
note = "Use `.with_relation(rerun::TransformRelation::ChildFromParent)` instead."
)]
pub fn from_parent(self) -> Self {
self.with_relation(TransformRelation::ChildFromParent)
}
}
1 change: 1 addition & 0 deletions crates/store/re_types/src/components/.gitattributes

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

2 changes: 2 additions & 0 deletions crates/store/re_types/src/components/mod.rs

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

Loading
Loading