Rerun C++ SDK
Loading...
Searching...
No Matches
translation_rotation_scale3d.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/datatypes/translation_rotation_scale3d.fbs".
3
4#pragma once
5
6#include "../compiler_utils.hpp"
7#include "../result.hpp"
8#include "rotation3d.hpp"
9#include "scale3d.hpp"
10#include "vec3d.hpp"
11
12#include <cstdint>
13#include <memory>
14#include <optional>
15
16namespace arrow {
17 class Array;
18 class DataType;
19 class StructBuilder;
20} // namespace arrow
21
22namespace rerun::datatypes {
23 /// **Datatype**: Representation of an affine transform via separate translation, rotation & scale.
25 /// 3D translation vector, applied last.
26 std::optional<rerun::datatypes::Vec3D> translation;
27
28 /// 3D rotation, applied second.
29 std::optional<rerun::datatypes::Rotation3D> rotation;
30
31 /// 3D scale, applied first.
32 std::optional<rerun::datatypes::Scale3D> scale;
33
34 /// If true, this transform is from the parent space to the space where the transform was logged.
35 ///
36 /// If false (default), the transform maps from this space to its parent,
37 /// i.e. the translation is the position in the parent space.
39
40 public:
41 // Extensions to generated type defined in 'translation_rotation_scale3d_ext.cpp'
42
43 /// Identity transformation.
44 ///
45 /// Applying this transform does not alter an entity's transformation.
46 /// It has all optional fields set to `std::nullopt`.
48
49 // Need to disable the maybe-uninitialized here because the compiler gets confused by the combination
50 // of union-types datatypes inside of an optional component.
51 //
52 // See: https://github.com/rerun-io/rerun/issues/4027
53 RERUN_DISABLE_MAYBE_UNINITIALIZED_PUSH
55 : translation(other.translation),
56 rotation(other.rotation),
57 scale(other.scale),
58 from_parent(other.from_parent) {}
59
60 RERUN_DISABLE_MAYBE_UNINITIALIZED_POP
61
62 /// Creates a new 3D transform from translation/rotation/scale.
63 ///
64 /// \param translation_ \copydoc TranslationRotationScale3D::translation
65 /// \param rotation_ \copydoc TranslationRotationScale3D::rotation
66 /// \param scale_ \copydoc TranslationRotationScale3D::scale
67 /// \param from_parent_ \copydoc TranslationRotationScale3D::from_parent
69 const std::optional<Vec3D>& translation_, const std::optional<Rotation3D>& rotation_,
70 const std::optional<Scale3D>& scale_, bool from_parent_ = false
71 )
72 : translation(translation_),
73 rotation(rotation_),
74 scale(scale_),
75 from_parent(from_parent_) {}
76
77 /// Creates a new 3D transform from translation/rotation/uniform-scale.
78 ///
79 /// \param translation_ \copydoc TranslationRotationScale3D::translation
80 /// \param rotation_ \copydoc TranslationRotationScale3D::rotation
81 /// \param uniform_scale Uniform scale factor that is applied to all axis equally.
82 /// \param from_parent_ \copydoc TranslationRotationScale3D::from_parent
83 ///
84 /// _Implementation note:_ This explicit overload prevents interpretation of the float as
85 /// bool, leading to a call to the wrong overload.
87 const Vec3D& translation_, const Rotation3D& rotation_, float uniform_scale,
88 bool from_parent_ = false
89 )
90 : translation(translation_),
91 rotation(rotation_),
92 scale(uniform_scale),
93 from_parent(from_parent_) {}
94
95 /// Creates a new rigid transform (translation & rotation only).
96 ///
97 /// \param translation_ \copydoc TranslationRotationScale3D::translation
98 /// \param rotation_ \copydoc TranslationRotationScale3D::rotation
99 /// \param from_parent_ \copydoc TranslationRotationScale3D::from_parent
101 const Vec3D& translation_, const Rotation3D& rotation_, bool from_parent_ = false
102 )
103 : translation(translation_),
104 rotation(rotation_),
105 scale(std::nullopt),
106 from_parent(from_parent_) {}
107
108 /// From translation & scale only.
109 ///
110 /// \param translation_ \copydoc TranslationRotationScale3D::translation
111 /// \param scale_ \copydoc TranslationRotationScale3D::scale
112 /// \param from_parent_ \copydoc TranslationRotationScale3D::from_parent
114 const Vec3D& translation_, const Scale3D& scale_, bool from_parent_ = false
115 )
116 : translation(translation_),
117 rotation(std::nullopt),
118 scale(scale_),
119 from_parent(from_parent_) {}
120
121 /// From translation & uniform scale.
122 ///
123 /// \param translation_ \copydoc TranslationRotationScale3D::translation
124 /// \param uniform_scale Uniform scale factor that is applied to all axis equally.
125 /// \param from_parent_ \copydoc TranslationRotationScale3D::from_parent
126 ///
127 /// _Implementation note:_ This explicit overload prevents interpretation of the float as
128 /// bool, leading to a call to the wrong overload.
130 const Vec3D& translation_, float uniform_scale, bool from_parent_ = false
131 )
132 : translation(translation_),
133 rotation(std::nullopt),
134 scale(uniform_scale),
135 from_parent(from_parent_) {}
136
137 /// From rotation & scale only.
138 ///
139 /// \param rotation_ \copydoc TranslationRotationScale3D::rotation
140 /// \param scale_ \copydoc TranslationRotationScale3D::scale
141 /// \param from_parent_ \copydoc TranslationRotationScale3D::from_parent
143 const Rotation3D& rotation_, const Scale3D& scale_, bool from_parent_ = false
144 )
145 : translation(std::nullopt),
146 rotation(rotation_),
147 scale(scale_),
148 from_parent(from_parent_) {}
149
150 /// From rotation & uniform scale.
151 ///
152 /// \param rotation_ \copydoc TranslationRotationScale3D::rotation
153 /// \param uniform_scale Uniform scale factor that is applied to all axis equally.
154 /// \param from_parent_ \copydoc TranslationRotationScale3D::from_parent
155 ///
156 /// _Implementation note:_ This explicit overload prevents interpretation of the float as
157 /// bool, leading to a call to the wrong overload.
159 const Rotation3D& rotation_, float uniform_scale, bool from_parent_ = false
160 )
161 : translation(std::nullopt),
162 rotation(rotation_),
163 scale(uniform_scale),
164 from_parent(from_parent_) {}
165
166 /// From translation only.
167 ///
168 /// \param translation_ 3D translation.
169 /// \param from_parent_
170 TranslationRotationScale3D(const Vec3D& translation_, bool from_parent_ = false)
171 : translation(translation_),
172 rotation(std::nullopt),
173 scale(std::nullopt),
174 from_parent(from_parent_) {}
175
176 /// From rotation only.
177 ///
178 /// \param rotation_ \copydoc TranslationRotationScale3D::rotation
179 /// \param from_parent_ \copydoc TranslationRotationScale3D::from_parent
180 TranslationRotationScale3D(const Rotation3D& rotation_, bool from_parent_ = false)
181 : translation(std::nullopt),
182 rotation(rotation_),
183 scale(std::nullopt),
184 from_parent(from_parent_) {}
185
186 /// From scale only.
187 ///
188 /// \param scale_ \copydoc TranslationRotationScale3D::scale
189 /// \param from_parent_ \copydoc TranslationRotationScale3D::from_parent
190 TranslationRotationScale3D(const Scale3D& scale_, bool from_parent_ = false)
191 : translation(std::nullopt),
192 rotation(std::nullopt),
193 scale(scale_),
194 from_parent(from_parent_) {}
195
196 public:
197 TranslationRotationScale3D() = default;
198 };
199} // namespace rerun::datatypes
200
201namespace rerun {
202 template <typename T>
203 struct Loggable;
204
205 /// \private
206 template <>
207 struct Loggable<datatypes::TranslationRotationScale3D> {
208 static constexpr const char Name[] = "rerun.datatypes.TranslationRotationScale3D";
209
210 /// Returns the arrow data type this type corresponds to.
211 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
212
213 /// Fills an arrow array builder with an array of this type.
214 static rerun::Error fill_arrow_array_builder(
215 arrow::StructBuilder* builder, const datatypes::TranslationRotationScale3D* elements,
216 size_t num_elements
217 );
218
219 /// Serializes an array of `rerun::datatypes::TranslationRotationScale3D` into an arrow array.
220 static Result<std::shared_ptr<arrow::Array>> to_arrow(
221 const datatypes::TranslationRotationScale3D* instances, size_t num_instances
222 );
223 };
224} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:87
All built-in datatypes. 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:20
Datatype: A 3D rotation.
Definition rotation3d.hpp:59
Datatype: 3D scaling factor, part of a transform representation.
Definition scale3d.hpp:58
Datatype: Representation of an affine transform via separate translation, rotation & scale.
Definition translation_rotation_scale3d.hpp:24
TranslationRotationScale3D(const Rotation3D &rotation_, float uniform_scale, bool from_parent_=false)
From rotation & uniform scale.
Definition translation_rotation_scale3d.hpp:158
TranslationRotationScale3D(const Vec3D &translation_, const Rotation3D &rotation_, float uniform_scale, bool from_parent_=false)
Creates a new 3D transform from translation/rotation/uniform-scale.
Definition translation_rotation_scale3d.hpp:86
RERUN_DISABLE_MAYBE_UNINITIALIZED_POP TranslationRotationScale3D(const std::optional< Vec3D > &translation_, const std::optional< Rotation3D > &rotation_, const std::optional< Scale3D > &scale_, bool from_parent_=false)
Creates a new 3D transform from translation/rotation/scale.
Definition translation_rotation_scale3d.hpp:68
std::optional< rerun::datatypes::Scale3D > scale
3D scale, applied first.
Definition translation_rotation_scale3d.hpp:32
TranslationRotationScale3D(const Scale3D &scale_, bool from_parent_=false)
From scale only.
Definition translation_rotation_scale3d.hpp:190
TranslationRotationScale3D(const Vec3D &translation_, float uniform_scale, bool from_parent_=false)
From translation & uniform scale.
Definition translation_rotation_scale3d.hpp:129
TranslationRotationScale3D(const Rotation3D &rotation_, bool from_parent_=false)
From rotation only.
Definition translation_rotation_scale3d.hpp:180
std::optional< rerun::datatypes::Vec3D > translation
3D translation vector, applied last.
Definition translation_rotation_scale3d.hpp:26
TranslationRotationScale3D(const Vec3D &translation_, const Rotation3D &rotation_, bool from_parent_=false)
Creates a new rigid transform (translation & rotation only).
Definition translation_rotation_scale3d.hpp:100
std::optional< rerun::datatypes::Rotation3D > rotation
3D rotation, applied second.
Definition translation_rotation_scale3d.hpp:29
TranslationRotationScale3D(const Rotation3D &rotation_, const Scale3D &scale_, bool from_parent_=false)
From rotation & scale only.
Definition translation_rotation_scale3d.hpp:142
static const TranslationRotationScale3D IDENTITY
Identity transformation.
Definition translation_rotation_scale3d.hpp:47
bool from_parent
If true, this transform is from the parent space to the space where the transform was logged.
Definition translation_rotation_scale3d.hpp:38
TranslationRotationScale3D(const Vec3D &translation_, const Scale3D &scale_, bool from_parent_=false)
From translation & scale only.
Definition translation_rotation_scale3d.hpp:113
TranslationRotationScale3D(const Vec3D &translation_, bool from_parent_=false)
From translation only.
Definition translation_rotation_scale3d.hpp:170
Datatype: A vector in 3D space.
Definition vec3d.hpp:20