Rerun C++ SDK
Loading...
Searching...
No Matches
transform3d.hpp
1// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/re_types/definitions/rerun/archetypes/transform3d.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../components/transform3d.hpp"
8#include "../data_cell.hpp"
9#include "../indicator_component.hpp"
10#include "../rerun_sdk_export.hpp"
11#include "../result.hpp"
12
13#include <cstdint>
14#include <utility>
15#include <vector>
16
17namespace rerun::archetypes {
18 /// **Archetype**: A 3D transform.
19 ///
20 /// ## Example
21 ///
22 /// ### Variety of 3D transforms
23 /// ![image](https://static.rerun.io/transform3d_simple/141368b07360ce3fcb1553079258ae3f42bdb9ac/full.png)
24 ///
25 /// ```cpp
26 /// #include <rerun.hpp>
27 ///
28 /// constexpr float TAU = 6.28318530717958647692528676655900577f;
29 ///
30 /// int main() {
31 /// const auto rec = rerun::RecordingStream("rerun_example_transform3d");
32 /// rec.spawn().exit_on_failure();
33 ///
34 /// auto arrow =
35 /// rerun::Arrows3D::from_vectors({{0.0f, 1.0f, 0.0f}}).with_origins({{0.0f, 0.0f, 0.0f}});
36 ///
37 /// rec.log("base", arrow);
38 ///
39 /// rec.log("base/translated", rerun::Transform3D({1.0f, 0.0f, 0.0f}));
40 /// rec.log("base/translated", arrow);
41 ///
42 /// rec.log(
43 /// "base/rotated_scaled",
44 /// rerun::Transform3D(
45 /// rerun::RotationAxisAngle({0.0f, 0.0f, 1.0f}, rerun::Angle::radians(TAU / 8.0f)),
46 /// 2.0f
47 /// )
48 /// );
49 /// rec.log("base/rotated_scaled", arrow);
50 /// }
51 /// ```
52 struct Transform3D {
53 /// The transform
55
56 public:
57 static constexpr const char IndicatorComponentName[] =
58 "rerun.components.Transform3DIndicator";
59
60 /// Indicator component, used to identify the archetype when converting to a list of components.
62
63 public:
64 // Extensions to generated type defined in 'transform3d_ext.cpp'
65
66 /// Identity transformation.
67 ///
68 /// Applying this transform does not alter an entity's transformation.
69 RERUN_SDK_EXPORT static const Transform3D IDENTITY;
70
71 /// New 3D transform from translation/matrix datatype.
72 ///
73 /// \param translation_and_mat3x3 Combined translation/matrix.
74 Transform3D(const datatypes::TranslationAndMat3x3& translation_and_mat3x3)
75 : Transform3D(datatypes::Transform3D::translation_and_mat3x3(translation_and_mat3x3)) {}
76
77 /// Creates a new 3D transform from translation and matrix provided as 3 columns.
78 ///
79 /// \param translation \çopydoc datatypes::TranslationAndMat3x3::translation
80 /// \param columns Column vectors of 3x3 matrix.
81 /// \param from_parent \copydoc datatypes::TranslationRotationScale3D::from_parent
82 ///
83 /// _Implementation note:_ This overload is necessary, otherwise the array may be
84 /// interpreted as bool and call the wrong overload.
86 const datatypes::Vec3D& translation, const datatypes::Vec3D (&columns)[3],
87 bool from_parent = false
88 )
89 : Transform3D(datatypes::TranslationAndMat3x3(translation, columns, from_parent)) {}
90
91 /// Creates a new 3D transform from translation/matrix.
92 ///
93 /// \param translation \çopydoc datatypes::TranslationAndMat3x3::translation
94 /// \param matrix \copydoc datatypes::TranslationAndMat3x3::mat3x3
95 /// \param from_parent \copydoc datatypes::TranslationAndMat3x3::from_parent
97 const datatypes::Vec3D& translation, const datatypes::Mat3x3& matrix,
98 bool from_parent = false
99 )
100 : Transform3D(datatypes::TranslationAndMat3x3(translation, matrix, from_parent)) {}
101
102 /// From translation only.
103 ///
104 /// \param translation \çopydoc datatypes::TranslationRotationScale3D::translation
105 /// \param from_parent \copydoc datatypes::TranslationRotationScale3D::from_parent
106 Transform3D(const datatypes::Vec3D& translation, bool from_parent = false)
107 : Transform3D(datatypes::TranslationRotationScale3D(translation, from_parent)) {}
108
109 /// From 3x3 matrix only.
110 ///
111 /// \param matrix \copydoc datatypes::TranslationAndMat3x3::mat3x3
112 /// \param from_parent \copydoc datatypes::TranslationAndMat3x3::from_parent
113 Transform3D(const datatypes::Mat3x3& matrix, bool from_parent = false)
114 : Transform3D(datatypes::TranslationAndMat3x3(matrix, from_parent)) {}
115
116 /// From 3x3 matrix provided as 3 columns only.
117 ///
118 /// \param columns Column vectors of 3x3 matrix.
119 /// \param from_parent \copydoc datatypes::TranslationRotationScale3D::from_parent
120 Transform3D(const datatypes::Vec3D (&columns)[3], bool from_parent = false)
121 : Transform3D(datatypes::TranslationAndMat3x3(columns, from_parent)) {}
122
123 /// New 3D transform from translation/rotation/scale datatype.
124 /// \param translation_rotation_scale3d Combined translation/rotation/scale.
125 Transform3D(const datatypes::TranslationRotationScale3D& translation_rotation_scale3d)
126 : Transform3D(
127 datatypes::Transform3D::translation_rotation_scale(translation_rotation_scale3d)
128 ) {}
129
130 /// Creates a new 3D transform from translation/rotation/scale.
131 ///
132 /// \param translation \copydoc datatypes::TranslationRotationScale3D::translation
133 /// \param rotation \copydoc datatypes::TranslationRotationScale3D::rotation
134 /// \param scale \copydoc datatypes::TranslationRotationScale3D::scale
135 /// \param from_parent \copydoc datatypes::TranslationRotationScale3D::from_parent
137 const datatypes::Vec3D& translation, const datatypes::Rotation3D& rotation,
138 const datatypes::Scale3D& scale, bool from_parent = false
139 )
140 : Transform3D(
141 datatypes::TranslationRotationScale3D(translation, rotation, scale, from_parent)
142 ) {}
143
144 /// Creates a new 3D transform from translation/rotation/uniform-scale.
145 ///
146 /// \param translation \copydoc datatypes::TranslationRotationScale3D::translation
147 /// \param rotation \copydoc datatypes::TranslationRotationScale3D::rotation
148 /// \param uniform_scale Uniform scale factor that is applied to all axis equally.
149 /// \param from_parent \copydoc datatypes::TranslationRotationScale3D::from_parent
150 ///
151 /// _Implementation note:_ This explicit overload prevents interpretation of the float as
152 /// bool, leading to a call to the wrong overload.
154 const datatypes::Vec3D& translation, const datatypes::Rotation3D& rotation,
155 float uniform_scale, bool from_parent = false
156 )
158 translation, rotation, uniform_scale, from_parent
159 )) {}
160
161 /// Creates a new rigid transform (translation & rotation only).
162 ///
163 /// \param translation \copydoc datatypes::TranslationRotationScale3D::translation
164 /// \param rotation \copydoc datatypes::TranslationRotationScale3D::rotation
165 /// \param from_parent \copydoc datatypes::TranslationRotationScale3D::from_parent
167 const datatypes::Vec3D& translation, const datatypes::Rotation3D& rotation,
168 bool from_parent = false
169 )
170 : Transform3D(datatypes::TranslationRotationScale3D(translation, rotation, from_parent)
171 ) {}
172
173 /// From translation & scale only.
174 ///
175 /// \param translation \copydoc datatypes::TranslationRotationScale3D::translation
176 /// \param scale datatypes::TranslationRotationScale3D::scale
177 /// \param from_parent \copydoc datatypes::TranslationRotationScale3D::from_parent
179 const datatypes::Vec3D& translation, const datatypes::Scale3D& scale,
180 bool from_parent = false
181 )
182 : Transform3D(datatypes::TranslationRotationScale3D(translation, scale, from_parent)) {}
183
184 /// From translation & uniform scale only.
185 ///
186 /// \param translation \copydoc datatypes::TranslationRotationScale3D::translation
187 /// \param uniform_scale Uniform scale factor that is applied to all axis equally.
188 /// \param from_parent \copydoc datatypes::TranslationRotationScale3D::from_parent
189 ///
190 /// _Implementation note:_ This explicit overload prevents interpretation of the float as
191 /// bool, leading to a call to the wrong overload.
193 const datatypes::Vec3D& translation, float uniform_scale, bool from_parent = false
194 )
195 : Transform3D(
196 datatypes::TranslationRotationScale3D(translation, uniform_scale, from_parent)
197 ) {}
198
199 /// From rotation & scale.
200 ///
201 /// \param rotation \copydoc datatypes::TranslationRotationScale3D::rotation
202 /// \param scale datatypes::TranslationRotationScale3D::scale
203 /// \param from_parent \copydoc datatypes::TranslationRotationScale3D::from_parent
205 const datatypes::Rotation3D& rotation, const datatypes::Scale3D& scale,
206 bool from_parent = false
207 )
208 : Transform3D(datatypes::TranslationRotationScale3D(rotation, scale, from_parent)) {}
209
210 /// From rotation & uniform scale.
211 ///
212 /// \param rotation \copydoc datatypes::TranslationRotationScale3D::rotation
213 /// \param uniform_scale Uniform scale factor that is applied to all axis equally.
214 /// \param from_parent \copydoc datatypes::TranslationRotationScale3D::from_parent
215 ///
216 /// _Implementation note:_ This explicit overload prevents interpretation of the float as
217 /// bool, leading to a call to the wrong overload.
219 const datatypes::Rotation3D& rotation, float uniform_scale, bool from_parent = false
220 )
221 : Transform3D(
222 datatypes::TranslationRotationScale3D(rotation, uniform_scale, from_parent)
223 ) {}
224
225 /// From rotation only.
226 ///
227 /// \param rotation \copydoc datatypes::TranslationRotationScale3D::rotation
228 /// \param from_parent \copydoc datatypes::TranslationRotationScale3D::from_parent
229 Transform3D(const datatypes::Rotation3D& rotation, bool from_parent = false)
230 : Transform3D(datatypes::TranslationRotationScale3D(rotation, from_parent)) {}
231
232 /// From scale only.
233 ///
234 /// \param scale \copydoc datatypes::TranslationRotationScale3D::from_parent
235 /// \param from_parent \copydoc datatypes::TranslationRotationScale3D::scale
236 Transform3D(const datatypes::Scale3D& scale, bool from_parent = false)
237 : Transform3D(datatypes::TranslationRotationScale3D(scale, from_parent)) {}
238
239 public:
240 Transform3D() = default;
241 Transform3D(Transform3D&& other) = default;
242
244 : transform(std::move(_transform)) {}
245 };
246
247} // namespace rerun::archetypes
248
249namespace rerun {
250 /// \private
251 template <typename T>
252 struct AsComponents;
253
254 /// \private
255 template <>
256 struct AsComponents<archetypes::Transform3D> {
257 /// Serialize all set component batches.
258 static Result<std::vector<DataCell>> serialize(const archetypes::Transform3D& archetype);
259 };
260} // namespace rerun
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:21
Archetype: A 3D transform.
Definition transform3d.hpp:52
Transform3D(const datatypes::Vec3D &translation, const datatypes::Rotation3D &rotation, float uniform_scale, bool from_parent=false)
Creates a new 3D transform from translation/rotation/uniform-scale.
Definition transform3d.hpp:153
static RERUN_SDK_EXPORT const Transform3D IDENTITY
Identity transformation.
Definition transform3d.hpp:69
Transform3D(const datatypes::Vec3D(&columns)[3], bool from_parent=false)
From 3x3 matrix provided as 3 columns only.
Definition transform3d.hpp:120
Transform3D(const datatypes::Rotation3D &rotation, const datatypes::Scale3D &scale, bool from_parent=false)
From rotation & scale.
Definition transform3d.hpp:204
Transform3D(const datatypes::Vec3D &translation, const datatypes::Vec3D(&columns)[3], bool from_parent=false)
Creates a new 3D transform from translation and matrix provided as 3 columns.
Definition transform3d.hpp:85
Transform3D(const datatypes::Vec3D &translation, const datatypes::Scale3D &scale, bool from_parent=false)
From translation & scale only.
Definition transform3d.hpp:178
Transform3D(const datatypes::Vec3D &translation, float uniform_scale, bool from_parent=false)
From translation & uniform scale only.
Definition transform3d.hpp:192
Transform3D(const datatypes::Scale3D &scale, bool from_parent=false)
From scale only.
Definition transform3d.hpp:236
Transform3D(const datatypes::TranslationRotationScale3D &translation_rotation_scale3d)
New 3D transform from translation/rotation/scale datatype.
Definition transform3d.hpp:125
Transform3D(const datatypes::TranslationAndMat3x3 &translation_and_mat3x3)
New 3D transform from translation/matrix datatype.
Definition transform3d.hpp:74
Transform3D(const datatypes::Mat3x3 &matrix, bool from_parent=false)
From 3x3 matrix only.
Definition transform3d.hpp:113
Transform3D(const datatypes::Vec3D &translation, const datatypes::Mat3x3 &matrix, bool from_parent=false)
Creates a new 3D transform from translation/matrix.
Definition transform3d.hpp:96
Transform3D(const datatypes::Vec3D &translation, bool from_parent=false)
From translation only.
Definition transform3d.hpp:106
Transform3D(const datatypes::Rotation3D &rotation, float uniform_scale, bool from_parent=false)
From rotation & uniform scale.
Definition transform3d.hpp:218
rerun::components::Transform3D transform
The transform.
Definition transform3d.hpp:54
Transform3D(const datatypes::Vec3D &translation, const datatypes::Rotation3D &rotation, bool from_parent=false)
Creates a new rigid transform (translation & rotation only).
Definition transform3d.hpp:166
Transform3D(const datatypes::Rotation3D &rotation, bool from_parent=false)
From rotation only.
Definition transform3d.hpp:229
Transform3D(const datatypes::Vec3D &translation, const datatypes::Rotation3D &rotation, const datatypes::Scale3D &scale, bool from_parent=false)
Creates a new 3D transform from translation/rotation/scale.
Definition transform3d.hpp:136
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:23
Component: An affine transform between two 3D spaces, represented in a given direction.
Definition transform3d.hpp:14
Datatype: A 3x3 Matrix.
Definition mat3x3.hpp:31
Datatype: A 3D rotation.
Definition rotation3d.hpp:60
Datatype: 3D scaling factor, part of a transform representation.
Definition scale3d.hpp:58
Datatype: Representation of an affine transform via a 3x3 affine matrix paired with a translation.
Definition translation_and_mat3x3.hpp:25
Datatype: Representation of an affine transform via separate translation, rotation & scale.
Definition translation_rotation_scale3d.hpp:25
Datatype: A vector in 3D space.
Definition vec3d.hpp:20