Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::archetypes::Transform3D Struct Reference

Archetype: A transform between two 3D spaces, i.e. More...

#include <rerun/archetypes/transform3d.hpp>

Public Types

using IndicatorComponent = rerun::components::IndicatorComponent< IndicatorComponentName >
 Indicator component, used to identify the archetype when converting to a list of components.
 

Public Member Functions

 Transform3D (const components::Translation3D &translation_, const datatypes::Vec3D(&columns)[3], bool from_parent=false)
 Creates a new 3D transform from translation and matrix provided as 3 columns.
 
 Transform3D (const components::Translation3D &translation_, const components::TransformMat3x3 &mat3x3_, bool from_parent=false)
 Creates a new 3D transform from translation/matrix.
 
 Transform3D (const components::Translation3D &translation_, bool from_parent=false)
 From translation only.
 
 Transform3D (const components::TransformMat3x3 &mat3x3_, bool from_parent=false)
 From 3x3 matrix only.
 
 Transform3D (const datatypes::Vec3D(&columns)[3], bool from_parent=false)
 From 3x3 matrix provided as 3 columns only.
 
 Transform3D (const components::Translation3D &translation_, const Rotation3D &rotation, const components::Scale3D &scale_, bool from_parent=false)
 Creates a new 3D transform from translation/rotation/scale.
 
 Transform3D (const components::Translation3D &translation_, const Rotation3D &rotation, float uniform_scale, bool from_parent=false)
 Creates a new 3D transform from translation/rotation/uniform-scale.
 
 Transform3D (const components::Translation3D &translation_, const Rotation3D &rotation, bool from_parent=false)
 Creates a new rigid transform (translation & rotation only).
 
 Transform3D (const components::Translation3D &translation_, const components::Scale3D &scale_, bool from_parent=false)
 From translation & scale only.
 
 Transform3D (const components::Translation3D &translation_, float uniform_scale, bool from_parent=false)
 From translation & uniform scale only.
 
 Transform3D (const Rotation3D &rotation, const components::Scale3D &scale_, bool from_parent=false)
 From rotation & scale.
 
 Transform3D (const Rotation3D &rotation, float uniform_scale, bool from_parent=false)
 From rotation & uniform scale.
 
 Transform3D (const Rotation3D &rotation, bool from_parent=false)
 From rotation only.
 
 Transform3D (const components::Scale3D &scale_, bool from_parent=false)
 From scale only.
 
 Transform3D (Transform3D &&other)=default
 
Transform3D with_translation (rerun::components::Translation3D _translation) &&
 Translation vector.
 
Transform3D with_rotation_axis_angle (rerun::components::RotationAxisAngle _rotation_axis_angle) &&
 Rotation via axis + angle.
 
Transform3D with_quaternion (rerun::components::RotationQuat _quaternion) &&
 Rotation via quaternion.
 
Transform3D with_scale (rerun::components::Scale3D _scale) &&
 Scaling factor.
 
Transform3D with_mat3x3 (rerun::components::TransformMat3x3 _mat3x3) &&
 3x3 transformation matrix.
 
Transform3D with_relation (rerun::components::TransformRelation _relation) &&
 Specifies the relation this transform establishes between this entity and its parent.
 
Transform3D with_axis_length (rerun::components::AxisLength _axis_length) &&
 Visual length of the 3 axes.
 

Static Public Member Functions

static Transform3D from_translation_mat3x3 (const components::Translation3D &translation, const components::TransformMat3x3 &mat3x3)
 From a translation applied after a 3x3 matrix.
 
static Transform3D from_translation_mat3x3 (const components::Translation3D &translation, const datatypes::Vec3D(&columns)[3])
 From a translation applied after a 3x3 matrix provided as 3 columns.
 
static Transform3D from_translation (const components::Translation3D &translation)
 From a translation.
 
static Transform3D from_mat3x3 (const components::TransformMat3x3 &mat3x3)
 From 3x3 matrix only.
 
static Transform3D from_mat3x3 (const datatypes::Vec3D(&columns)[3])
 From 3x3 matrix provided as 3 columns only.
 
static Transform3D from_translation_rotation_scale (const components::Translation3D &translation, const Rotation3D &rotation, const components::Scale3D &scale)
 From a translation, applied after a rotation & scale, known as an affine transformation.
 
static Transform3D from_translation_rotation_scale (const components::Translation3D &translation, const Rotation3D &rotation, float uniform_scale)
 From a translation, applied after a rotation & scale, known as an affine transformation.
 
static Transform3D from_translation_rotation (const components::Translation3D &translation, const Rotation3D &rotation)
 From a rotation & scale.
 
static Transform3D from_translation_scale (const components::Translation3D &translation, const components::Scale3D &scale)
 From a translation applied after a scale.
 
static Transform3D from_rotation_scale (const Rotation3D &rotation, const components::Scale3D &scale)
 From a rotation & scale.
 
static Transform3D from_rotation_scale (const Rotation3D &rotation, float uniform_scale)
 From a rotation & uniform scale.
 
static Transform3D from_rotation (const Rotation3D &rotation)
 From rotation only.
 
static Transform3D from_scale (const components::Scale3D &scale)
 From scale only.
 
static Transform3D from_scale (float uniform_scale)
 From scale only.
 

Public Attributes

std::optional< rerun::components::Translation3Dtranslation
 Translation vector.
 
std::optional< rerun::components::RotationAxisAnglerotation_axis_angle
 Rotation via axis + angle.
 
std::optional< rerun::components::RotationQuatquaternion
 Rotation via quaternion.
 
std::optional< rerun::components::Scale3Dscale
 Scaling factor.
 
std::optional< rerun::components::TransformMat3x3mat3x3
 3x3 transformation matrix.
 
std::optional< rerun::components::TransformRelationrelation
 Specifies the relation this transform establishes between this entity and its parent.
 
std::optional< rerun::components::AxisLengthaxis_length
 Visual length of the 3 axes.
 

Static Public Attributes

static constexpr const char IndicatorComponentName []
 
static RERUN_SDK_EXPORT const Transform3D IDENTITY
 Identity transformation.
 

Detailed Description

Archetype: A transform between two 3D spaces, i.e.

a pose.

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.

Whenever you log this archetype, it will write all components, even if you do not explicitly set them. This means that if you first log a transform with only a translation, and then log one with only a rotation, it will be resolved to a transform with only a rotation.

Examples

Variety of 3D transforms

image

#include <rerun.hpp>
constexpr float TAU = 6.28318530717958647692528676655900577f;
int main() {
const auto rec = rerun::RecordingStream("rerun_example_transform3d");
rec.spawn().exit_on_failure();
auto arrow =
rerun::Arrows3D::from_vectors({{0.0f, 1.0f, 0.0f}}).with_origins({{0.0f, 0.0f, 0.0f}});
rec.log("base", arrow);
rec.log("base/translated", rerun::Transform3D::from_translation({1.0f, 0.0f, 0.0f}));
rec.log("base/translated", arrow);
rec.log(
"base/rotated_scaled",
rerun::Transform3D::from_rotation_scale(
rerun::RotationAxisAngle({0.0f, 0.0f, 1.0f}, rerun::Angle::radians(TAU / 8.0f)),
2.0f
)
);
rec.log("base/rotated_scaled", arrow);
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:60
static Angle radians(float radians_)
New angle in radians.
Definition angle.hpp:30
Datatype: 3D rotation represented by a rotation around a given axis.
Definition rotation_axis_angle.hpp:21

Transform hierarchy

image

#include <rerun.hpp>
constexpr float TAU = 6.28318530717958647692528676655900577f;
int main() {
const auto rec = rerun::RecordingStream("rerun_example_transform3d_hierarchy");
rec.spawn().exit_on_failure();
// TODO(#5521): log two space views as in the python example
rec.set_time_seconds("sim_time", 0.0);
// Planetary motion is typically in the XY plane.
rec.log_static("/", rerun::ViewCoordinates::RIGHT_HAND_Z_UP);
// Setup points, all are in the center of their own space:
rec.log(
"sun",
rerun::Points3D({{0.0f, 0.0f, 0.0f}})
.with_radii({1.0f})
.with_colors({rerun::Color(255, 200, 10)})
);
rec.log(
"sun/planet",
rerun::Points3D({{0.0f, 0.0f, 0.0f}})
.with_radii({0.4f})
.with_colors({rerun::Color(40, 80, 200)})
);
rec.log(
"sun/planet/moon",
rerun::Points3D({{0.0f, 0.0f, 0.0f}})
.with_radii({0.15f})
.with_colors({rerun::Color(180, 180, 180)})
);
// Draw fixed paths where the planet & moon move.
float d_planet = 6.0f;
float d_moon = 3.0f;
std::vector<std::array<float, 3>> planet_path, moon_path;
for (int i = 0; i <= 100; i++) {
float angle = static_cast<float>(i) * 0.01f * TAU;
float circle_x = std::sin(angle);
float circle_y = std::cos(angle);
planet_path.push_back({circle_x * d_planet, circle_y * d_planet, 0.0f});
moon_path.push_back({circle_x * d_moon, circle_y * d_moon, 0.0f});
}
rec.log("sun/planet_path", rerun::LineStrips3D(rerun::LineStrip3D(planet_path)));
rec.log("sun/planet/moon_path", rerun::LineStrips3D(rerun::LineStrip3D(moon_path)));
// Movement via transforms.
for (int i = 0; i <6 * 120; i++) {
float time = static_cast<float>(i) / 120.0f;
rec.set_time_seconds("sim_time", time);
float r_moon = time * 5.0f;
float r_planet = time * 2.0f;
rec.log(
"sun/planet",
rerun::Transform3D::from_translation_rotation(
{std::sin(r_planet) * d_planet, std::cos(r_planet) * d_planet, 0.0f},
{1.0, 0.0f, 0.0f},
}
)
);
rec.log(
"sun/planet/moon",
rerun::Transform3D::from_translation(
{std::cos(r_moon) * d_moon, std::sin(r_moon) * d_moon, 0.0f}
)
);
}
}
@ ChildFromParent
The transform describes how to transform into the child entity's space.
Archetype: 3D line strips with positions and optional colors, radii, labels, etc.
Definition line_strips3d.hpp:102
Archetype: A 3D point cloud with positions and optional colors, radii, labels, etc.
Definition points3d.hpp:155
Transform3D with_relation(rerun::components::TransformRelation _relation) &&
Specifies the relation this transform establishes between this entity and its parent.
Definition transform3d.hpp:555
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:17
Component: A line strip in 3D space.
Definition line_strip3d.hpp:33
static Angle degrees(float degrees_)
New angle in degrees.
Definition angle.hpp:39

Constructor & Destructor Documentation

◆ Transform3D() [1/14]

rerun::archetypes::Transform3D::Transform3D ( const components::Translation3D translation_,
const datatypes::Vec3D(&)  columns[3],
bool  from_parent = false 
)
inline

Creates a new 3D transform from translation and matrix provided as 3 columns.

Parameters
translation_\çopydoc Transform3D::translation
columnsColumn vectors of 3x3 matrix.
from_parentIf true, the transform relation to TransformRelation::ChildFromParent.

Implementation note: This overload is necessary, otherwise the array may be interpreted as bool and call the wrong overload.

◆ Transform3D() [2/14]

rerun::archetypes::Transform3D::Transform3D ( const components::Translation3D translation_,
const components::TransformMat3x3 mat3x3_,
bool  from_parent = false 
)
inline

Creates a new 3D transform from translation/matrix.

Parameters
translation_\çopydoc Transform3D::translation
mat3x3_3x3 transformation matrix.
from_parentIf true, the transform relation to TransformRelation::ChildFromParent.

◆ Transform3D() [3/14]

rerun::archetypes::Transform3D::Transform3D ( const components::Translation3D translation_,
bool  from_parent = false 
)
inline

From translation only.

Parameters
translation_\çopydoc Transform3D::translation
from_parentIf true, the transform relation to TransformRelation::ChildFromParent.

◆ Transform3D() [4/14]

rerun::archetypes::Transform3D::Transform3D ( const components::TransformMat3x3 mat3x3_,
bool  from_parent = false 
)
inline

From 3x3 matrix only.

Parameters
mat3x3_3x3 transformation matrix.
from_parentIf true, the transform relation to TransformRelation::ChildFromParent.

◆ Transform3D() [5/14]

rerun::archetypes::Transform3D::Transform3D ( const datatypes::Vec3D(&)  columns[3],
bool  from_parent = false 
)
inline

From 3x3 matrix provided as 3 columns only.

Parameters
columnsColumn vectors of 3x3 matrix.
from_parentIf true, the transform relation to TransformRelation::ChildFromParent.

◆ Transform3D() [6/14]

rerun::archetypes::Transform3D::Transform3D ( const components::Translation3D translation_,
const Rotation3D rotation,
const components::Scale3D scale_,
bool  from_parent = false 
)
inline

Creates a new 3D transform from translation/rotation/scale.

Parameters
translation_Translation vector.
rotationRotation represented either as a quaternion or axis + angle rotation.
scale_Scaling factor.
from_parentIf true, the transform relation to TransformRelation::ChildFromParent.

◆ Transform3D() [7/14]

rerun::archetypes::Transform3D::Transform3D ( const components::Translation3D translation_,
const Rotation3D rotation,
float  uniform_scale,
bool  from_parent = false 
)
inline

Creates a new 3D transform from translation/rotation/uniform-scale.

Parameters
translation_Translation vector.
rotationRotation represented either as a quaternion or axis + angle rotation.
uniform_scaleUniform scale factor that is applied to all axis equally.
from_parentIf true, the transform relation to TransformRelation::ChildFromParent.

Implementation note: This explicit overload prevents interpretation of the float as bool, leading to a call to the wrong overload.

◆ Transform3D() [8/14]

rerun::archetypes::Transform3D::Transform3D ( const components::Translation3D translation_,
const Rotation3D rotation,
bool  from_parent = false 
)
inline

Creates a new rigid transform (translation & rotation only).

Parameters
translation_Translation vector.
rotationRotation represented either as a quaternion or axis + angle rotation.
from_parentIf true, the transform relation to TransformRelation::ChildFromParent.

◆ Transform3D() [9/14]

rerun::archetypes::Transform3D::Transform3D ( const components::Translation3D translation_,
const components::Scale3D scale_,
bool  from_parent = false 
)
inline

From translation & scale only.

Parameters
translation_Translation vector.
scale_Transform3D::scale
from_parentIf true, the transform relation to TransformRelation::ChildFromParent.

◆ Transform3D() [10/14]

rerun::archetypes::Transform3D::Transform3D ( const components::Translation3D translation_,
float  uniform_scale,
bool  from_parent = false 
)
inline

From translation & uniform scale only.

Parameters
translation_Translation vector.
uniform_scaleUniform scale factor that is applied to all axis equally.
from_parentIf true, the transform relation to TransformRelation::ChildFromParent.

Implementation note: This explicit overload prevents interpretation of the float as bool, leading to a call to the wrong overload.

◆ Transform3D() [11/14]

rerun::archetypes::Transform3D::Transform3D ( const Rotation3D rotation,
const components::Scale3D scale_,
bool  from_parent = false 
)
inline

From rotation & scale.

Parameters
rotationRotation represented either as a quaternion or axis + angle rotation.
scale_Transform3D::scale
from_parentIf true, the transform relation to TransformRelation::ChildFromParent.

◆ Transform3D() [12/14]

rerun::archetypes::Transform3D::Transform3D ( const Rotation3D rotation,
float  uniform_scale,
bool  from_parent = false 
)
inline

From rotation & uniform scale.

Parameters
rotationRotation represented either as a quaternion or axis + angle rotation.
uniform_scaleUniform scale factor that is applied to all axis equally.
from_parentIf true, the transform relation to TransformRelation::ChildFromParent.

Implementation note: This explicit overload prevents interpretation of the float as bool, leading to a call to the wrong overload.

◆ Transform3D() [13/14]

rerun::archetypes::Transform3D::Transform3D ( const Rotation3D rotation,
bool  from_parent = false 
)
inline

From rotation only.

Parameters
rotationRotation represented either as a quaternion or axis + angle rotation.
from_parentIf true, the transform relation to TransformRelation::ChildFromParent.

◆ Transform3D() [14/14]

rerun::archetypes::Transform3D::Transform3D ( const components::Scale3D scale_,
bool  from_parent = false 
)
inline

From scale only.

Parameters
scale_If true, the transform relation to TransformRelation::ChildFromParent.
from_parentScaling factor.

Member Function Documentation

◆ from_translation_mat3x3() [1/2]

static Transform3D rerun::archetypes::Transform3D::from_translation_mat3x3 ( const components::Translation3D translation,
const components::TransformMat3x3 mat3x3 
)
inlinestatic

From a translation applied after a 3x3 matrix.

Parameters
translation\çopydoc Transform3D::translation
mat3x33x3 transformation matrix.

◆ from_translation_mat3x3() [2/2]

static Transform3D rerun::archetypes::Transform3D::from_translation_mat3x3 ( const components::Translation3D translation,
const datatypes::Vec3D(&)  columns[3] 
)
inlinestatic

From a translation applied after a 3x3 matrix provided as 3 columns.

Parameters
translation\çopydoc Transform3D::translation
columnsColumn vectors of 3x3 matrix.

◆ from_translation()

static Transform3D rerun::archetypes::Transform3D::from_translation ( const components::Translation3D translation)
inlinestatic

From a translation.

Parameters
translation\çopydoc Transform3D::translation

◆ from_mat3x3() [1/2]

static Transform3D rerun::archetypes::Transform3D::from_mat3x3 ( const components::TransformMat3x3 mat3x3)
inlinestatic

From 3x3 matrix only.

Parameters
mat3x33x3 transformation matrix.

◆ from_mat3x3() [2/2]

static Transform3D rerun::archetypes::Transform3D::from_mat3x3 ( const datatypes::Vec3D(&)  columns[3])
inlinestatic

From 3x3 matrix provided as 3 columns only.

Parameters
columnsColumn vectors of 3x3 matrix.

◆ from_translation_rotation_scale() [1/2]

static Transform3D rerun::archetypes::Transform3D::from_translation_rotation_scale ( const components::Translation3D translation,
const Rotation3D rotation,
const components::Scale3D scale 
)
inlinestatic

From a translation, applied after a rotation & scale, known as an affine transformation.

Parameters
translationTranslation vector.
rotationRotation represented either as a quaternion or axis + angle rotation.
scaleScaling factor.

◆ from_translation_rotation_scale() [2/2]

static Transform3D rerun::archetypes::Transform3D::from_translation_rotation_scale ( const components::Translation3D translation,
const Rotation3D rotation,
float  uniform_scale 
)
inlinestatic

From a translation, applied after a rotation & scale, known as an affine transformation.

Parameters
translationTranslation vector.
rotationRotation represented either as a quaternion or axis + angle rotation.
uniform_scaleUniform scale factor that is applied to all axis equally.

◆ from_translation_rotation()

static Transform3D rerun::archetypes::Transform3D::from_translation_rotation ( const components::Translation3D translation,
const Rotation3D rotation 
)
inlinestatic

From a rotation & scale.

Parameters
translationTranslation vector.
rotationRotation represented either as a quaternion or axis + angle rotation.

◆ from_translation_scale()

static Transform3D rerun::archetypes::Transform3D::from_translation_scale ( const components::Translation3D translation,
const components::Scale3D scale 
)
inlinestatic

From a translation applied after a scale.

Parameters
translationTranslation vector.
scaleTransform3D::scale

◆ from_rotation_scale() [1/2]

static Transform3D rerun::archetypes::Transform3D::from_rotation_scale ( const Rotation3D rotation,
const components::Scale3D scale 
)
inlinestatic

From a rotation & scale.

Parameters
rotationRotation represented either as a quaternion or axis + angle rotation.
scaleTransform3D::scale

◆ from_rotation_scale() [2/2]

static Transform3D rerun::archetypes::Transform3D::from_rotation_scale ( const Rotation3D rotation,
float  uniform_scale 
)
inlinestatic

From a rotation & uniform scale.

Parameters
rotationRotation represented either as a quaternion or axis + angle rotation.
uniform_scaleUniform scale factor that is applied to all axis equally.

◆ from_rotation()

static Transform3D rerun::archetypes::Transform3D::from_rotation ( const Rotation3D rotation)
inlinestatic

From rotation only.

Parameters
rotationRotation represented either as a quaternion or axis + angle rotation.

◆ from_scale() [1/2]

static Transform3D rerun::archetypes::Transform3D::from_scale ( const components::Scale3D scale)
inlinestatic

From scale only.

Parameters
scaleTransform3D::scale

◆ from_scale() [2/2]

static Transform3D rerun::archetypes::Transform3D::from_scale ( float  uniform_scale)
inlinestatic

From scale only.

Parameters
uniform_scaleUniform scale factor that is applied to all axis equally.

◆ with_axis_length()

Transform3D rerun::archetypes::Transform3D::with_axis_length ( rerun::components::AxisLength  _axis_length) &&
inline

Visual length of the 3 axes.

The length is interpreted in the local coordinate system of the transform. If the transform is scaled, the axes will be scaled accordingly.

Member Data Documentation

◆ axis_length

std::optional<rerun::components::AxisLength> rerun::archetypes::Transform3D::axis_length

Visual length of the 3 axes.

The length is interpreted in the local coordinate system of the transform. If the transform is scaled, the axes will be scaled accordingly.

◆ IndicatorComponentName

constexpr const char rerun::archetypes::Transform3D::IndicatorComponentName[]
staticconstexpr
Initial value:
=
"rerun.components.Transform3DIndicator"

◆ IDENTITY

RERUN_SDK_EXPORT const Transform3D rerun::archetypes::Transform3D::IDENTITY
static

Identity transformation.

Applying this transform does not alter an entity's transformation.


The documentation for this struct was generated from the following file: