Rerun C++ SDK
Loading...
Searching...
No Matches
instance_poses3d.hpp
1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/store/re_types/definitions/rerun/archetypes/instance_poses3d.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../component_batch.hpp"
9#include "../components/pose_rotation_axis_angle.hpp"
10#include "../components/pose_rotation_quat.hpp"
11#include "../components/pose_scale3d.hpp"
12#include "../components/pose_transform_mat3x3.hpp"
13#include "../components/pose_translation3d.hpp"
14#include "../indicator_component.hpp"
15#include "../result.hpp"
16
17#include <cstdint>
18#include <optional>
19#include <utility>
20#include <vector>
21
22namespace rerun::archetypes {
23 /// **Archetype**: One or more transforms between the current entity and its parent. Unlike `archetypes::Transform3D`, it is *not* propagated in the transform hierarchy.
24 ///
25 /// If both `archetypes::InstancePoses3D` and `archetypes::Transform3D` are present,
26 /// first the tree propagating `archetypes::Transform3D` is applied, then `archetypes::InstancePoses3D`.
27 ///
28 /// Currently, many visualizers support only a single instance transform per entity.
29 /// Check archetype documentations for details - if not otherwise specified, only the first instance transform is applied.
30 ///
31 /// From the point of view of the entity's coordinate system,
32 /// all components are applied in the inverse order they are listed here.
33 /// E.g. if both a translation and a max3x3 transform are present,
34 /// the 3x3 matrix is applied first, followed by the translation.
35 ///
36 /// ## Example
37 ///
38 /// ### Regular & instance transforms in tandem
39 /// ![image](https://static.rerun.io/leaf_transform3d/41674f0082d6de489f8a1cd1583f60f6b5820ddf/full.png)
40 ///
41 /// ```cpp
42 /// #include <rerun.hpp>
43 /// #include <rerun/demo_utils.hpp>
44 ///
45 /// int main() {
46 /// const auto rec = rerun::RecordingStream("rerun_example_instance_pose3d_combined");
47 /// rec.set_time_sequence("frame", 0);
48 ///
49 /// // Log a box and points further down in the hierarchy.
50 /// rec.log("world/box", rerun::Boxes3D::from_half_sizes({{1.0, 1.0, 1.0}}));
51 /// rec.log(
52 /// "world/box/points",
53 /// rerun::Points3D(rerun::demo::grid3d<rerun::Position3D, float>(-10.0f, 10.0f, 10))
54 /// );
55 ///
56 /// for (int i = 0; i <180; ++i) {
57 /// rec.set_time_sequence("frame", i);
58 ///
59 /// // Log a regular transform which affects both the box and the points.
60 /// rec.log(
61 /// "world/box",
62 /// rerun::Transform3D::from_rotation(rerun::RotationAxisAngle{
63 /// {0.0f, 0.0f, 1.0f},
64 /// rerun::Angle::degrees(static_cast<float>(i) * 2.0f)})
65 /// );
66 ///
67 /// // Log an instance pose which affects only the box.
68 /// rec.log(
69 /// "world/box",
70 /// rerun::InstancePoses3D().with_translations(
71 /// {{0.0f, 0.0f, std::abs(static_cast<float>(i) * 0.1f - 5.0f) - 5.0f}}
72 /// )
73 /// );
74 /// }
75 /// }
76 /// ```
78 /// Translation vectors.
79 std::optional<Collection<rerun::components::PoseTranslation3D>> translations;
80
81 /// Rotations via axis + angle.
82 std::optional<Collection<rerun::components::PoseRotationAxisAngle>> rotation_axis_angles;
83
84 /// Rotations via quaternion.
85 std::optional<Collection<rerun::components::PoseRotationQuat>> quaternions;
86
87 /// Scaling factors.
88 std::optional<Collection<rerun::components::PoseScale3D>> scales;
89
90 /// 3x3 transformation matrices.
91 std::optional<Collection<rerun::components::PoseTransformMat3x3>> mat3x3;
92
93 public:
94 static constexpr const char IndicatorComponentName[] =
95 "rerun.components.InstancePoses3DIndicator";
96
97 /// Indicator component, used to identify the archetype when converting to a list of components.
99
100 public:
101 InstancePoses3D() = default;
102 InstancePoses3D(InstancePoses3D&& other) = default;
103
104 /// Translation vectors.
107 ) && {
108 translations = std::move(_translations);
109 // See: https://github.com/rerun-io/rerun/issues/4027
110 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
111 }
112
113 /// Rotations via axis + angle.
116 ) && {
117 rotation_axis_angles = std::move(_rotation_axis_angles);
118 // See: https://github.com/rerun-io/rerun/issues/4027
119 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
120 }
121
122 /// Rotations via quaternion.
125 ) && {
126 quaternions = std::move(_quaternions);
127 // See: https://github.com/rerun-io/rerun/issues/4027
128 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
129 }
130
131 /// Scaling factors.
133 scales = std::move(_scales);
134 // See: https://github.com/rerun-io/rerun/issues/4027
135 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
136 }
137
138 /// 3x3 transformation matrices.
140 mat3x3 = std::move(_mat3x3);
141 // See: https://github.com/rerun-io/rerun/issues/4027
142 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
143 }
144 };
145
146} // namespace rerun::archetypes
147
148namespace rerun {
149 /// \private
150 template <typename T>
151 struct AsComponents;
152
153 /// \private
154 template <>
155 struct AsComponents<archetypes::InstancePoses3D> {
156 /// Serialize all set component batches.
157 static Result<std::vector<ComponentBatch>> serialize(
158 const archetypes::InstancePoses3D& archetype
159 );
160 };
161} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:72
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
Archetype: One or more transforms between the current entity and its parent.
Definition instance_poses3d.hpp:77
std::optional< Collection< rerun::components::PoseRotationQuat > > quaternions
Rotations via quaternion.
Definition instance_poses3d.hpp:85
std::optional< Collection< rerun::components::PoseTranslation3D > > translations
Translation vectors.
Definition instance_poses3d.hpp:79
std::optional< Collection< rerun::components::PoseRotationAxisAngle > > rotation_axis_angles
Rotations via axis + angle.
Definition instance_poses3d.hpp:82
InstancePoses3D with_mat3x3(Collection< rerun::components::PoseTransformMat3x3 > _mat3x3) &&
3x3 transformation matrices.
Definition instance_poses3d.hpp:139
InstancePoses3D with_translations(Collection< rerun::components::PoseTranslation3D > _translations) &&
Translation vectors.
Definition instance_poses3d.hpp:105
std::optional< Collection< rerun::components::PoseScale3D > > scales
Scaling factors.
Definition instance_poses3d.hpp:88
InstancePoses3D with_quaternions(Collection< rerun::components::PoseRotationQuat > _quaternions) &&
Rotations via quaternion.
Definition instance_poses3d.hpp:123
InstancePoses3D with_rotation_axis_angles(Collection< rerun::components::PoseRotationAxisAngle > _rotation_axis_angles) &&
Rotations via axis + angle.
Definition instance_poses3d.hpp:114
InstancePoses3D with_scales(Collection< rerun::components::PoseScale3D > _scales) &&
Scaling factors.
Definition instance_poses3d.hpp:132
std::optional< Collection< rerun::components::PoseTransformMat3x3 > > mat3x3
3x3 transformation matrices.
Definition instance_poses3d.hpp:91
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:30