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 /// From the point of view of the entity's coordinate system,
29 /// all components are applied in the inverse order they are listed here.
30 /// E.g. if both a translation and a max3x3 transform are present,
31 /// the 3x3 matrix is applied first, followed by the translation.
32 ///
33 /// Currently, many visualizers support only a single instance transform per entity.
34 /// Check archetype documentations for details - if not otherwise specified, only the first instance transform is applied.
35 /// Some visualizers like the mesh visualizer used for `archetypes::Mesh3D`,
36 /// will draw an object for every pose, a behavior also known as "instancing".
37 ///
38 /// ## Example
39 ///
40 /// ### Regular & instance transforms in tandem
41 /// ![image](https://static.rerun.io/leaf_transform3d/41674f0082d6de489f8a1cd1583f60f6b5820ddf/full.png)
42 ///
43 /// ```cpp
44 /// #include <rerun.hpp>
45 /// #include <rerun/demo_utils.hpp>
46 ///
47 /// int main() {
48 /// const auto rec = rerun::RecordingStream("rerun_example_instance_pose3d_combined");
49 /// rec.set_time_sequence("frame", 0);
50 ///
51 /// // Log a box and points further down in the hierarchy.
52 /// rec.log("world/box", rerun::Boxes3D::from_half_sizes({{1.0, 1.0, 1.0}}));
53 /// rec.log(
54 /// "world/box/points",
55 /// rerun::Points3D(rerun::demo::grid3d<rerun::Position3D, float>(-10.0f, 10.0f, 10))
56 /// );
57 ///
58 /// for (int i = 0; i <180; ++i) {
59 /// rec.set_time_sequence("frame", i);
60 ///
61 /// // Log a regular transform which affects both the box and the points.
62 /// rec.log(
63 /// "world/box",
64 /// rerun::Transform3D::from_rotation(rerun::RotationAxisAngle{
65 /// {0.0f, 0.0f, 1.0f},
66 /// rerun::Angle::degrees(static_cast<float>(i) * 2.0f)})
67 /// );
68 ///
69 /// // Log an instance pose which affects only the box.
70 /// rec.log(
71 /// "world/box",
72 /// rerun::InstancePoses3D().with_translations(
73 /// {{0.0f, 0.0f, std::abs(static_cast<float>(i) * 0.1f - 5.0f) - 5.0f}}
74 /// )
75 /// );
76 /// }
77 /// }
78 /// ```
80 /// Translation vectors.
81 std::optional<Collection<rerun::components::PoseTranslation3D>> translations;
82
83 /// Rotations via axis + angle.
84 std::optional<Collection<rerun::components::PoseRotationAxisAngle>> rotation_axis_angles;
85
86 /// Rotations via quaternion.
87 std::optional<Collection<rerun::components::PoseRotationQuat>> quaternions;
88
89 /// Scaling factors.
90 std::optional<Collection<rerun::components::PoseScale3D>> scales;
91
92 /// 3x3 transformation matrices.
93 std::optional<Collection<rerun::components::PoseTransformMat3x3>> mat3x3;
94
95 public:
96 static constexpr const char IndicatorComponentName[] =
97 "rerun.components.InstancePoses3DIndicator";
98
99 /// Indicator component, used to identify the archetype when converting to a list of components.
101
102 public:
103 InstancePoses3D() = default;
104 InstancePoses3D(InstancePoses3D&& other) = default;
105
106 /// Translation vectors.
109 ) && {
110 translations = std::move(_translations);
111 // See: https://github.com/rerun-io/rerun/issues/4027
112 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
113 }
114
115 /// Rotations via axis + angle.
118 ) && {
119 rotation_axis_angles = std::move(_rotation_axis_angles);
120 // See: https://github.com/rerun-io/rerun/issues/4027
121 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
122 }
123
124 /// Rotations via quaternion.
127 ) && {
128 quaternions = std::move(_quaternions);
129 // See: https://github.com/rerun-io/rerun/issues/4027
130 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
131 }
132
133 /// Scaling factors.
135 scales = std::move(_scales);
136 // See: https://github.com/rerun-io/rerun/issues/4027
137 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
138 }
139
140 /// 3x3 transformation matrices.
142 mat3x3 = std::move(_mat3x3);
143 // See: https://github.com/rerun-io/rerun/issues/4027
144 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
145 }
146 };
147
148} // namespace rerun::archetypes
149
150namespace rerun {
151 /// \private
152 template <typename T>
153 struct AsComponents;
154
155 /// \private
156 template <>
157 struct AsComponents<archetypes::InstancePoses3D> {
158 /// Serialize all set component batches.
159 static Result<std::vector<ComponentBatch>> serialize(
160 const archetypes::InstancePoses3D& archetype
161 );
162 };
163} // 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:77
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Archetype: One or more transforms between the current entity and its parent.
Definition instance_poses3d.hpp:79
std::optional< Collection< rerun::components::PoseRotationQuat > > quaternions
Rotations via quaternion.
Definition instance_poses3d.hpp:87
std::optional< Collection< rerun::components::PoseTranslation3D > > translations
Translation vectors.
Definition instance_poses3d.hpp:81
std::optional< Collection< rerun::components::PoseRotationAxisAngle > > rotation_axis_angles
Rotations via axis + angle.
Definition instance_poses3d.hpp:84
InstancePoses3D with_mat3x3(Collection< rerun::components::PoseTransformMat3x3 > _mat3x3) &&
3x3 transformation matrices.
Definition instance_poses3d.hpp:141
InstancePoses3D with_translations(Collection< rerun::components::PoseTranslation3D > _translations) &&
Translation vectors.
Definition instance_poses3d.hpp:107
std::optional< Collection< rerun::components::PoseScale3D > > scales
Scaling factors.
Definition instance_poses3d.hpp:90
InstancePoses3D with_quaternions(Collection< rerun::components::PoseRotationQuat > _quaternions) &&
Rotations via quaternion.
Definition instance_poses3d.hpp:125
InstancePoses3D with_rotation_axis_angles(Collection< rerun::components::PoseRotationAxisAngle > _rotation_axis_angles) &&
Rotations via axis + angle.
Definition instance_poses3d.hpp:116
InstancePoses3D with_scales(Collection< rerun::components::PoseScale3D > _scales) &&
Scaling factors.
Definition instance_poses3d.hpp:134
std::optional< Collection< rerun::components::PoseTransformMat3x3 > > mat3x3
3x3 transformation matrices.
Definition instance_poses3d.hpp:93
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32