Rerun C++ SDK
Loading...
Searching...
No Matches
transform3d.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/transform3d.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../component_batch.hpp"
9#include "../component_column.hpp"
10#include "../components/axis_length.hpp"
11#include "../components/rotation_axis_angle.hpp"
12#include "../components/rotation_quat.hpp"
13#include "../components/scale3d.hpp"
14#include "../components/transform_frame_id.hpp"
15#include "../components/transform_mat3x3.hpp"
16#include "../components/transform_relation.hpp"
17#include "../components/translation3d.hpp"
18#include "../rerun_sdk_export.hpp"
19#include "../result.hpp"
20#include "../rotation3d.hpp"
21
22#include <cstdint>
23#include <optional>
24#include <utility>
25#include <vector>
26
27namespace rerun::archetypes {
28 /// **Archetype**: A transform between two 3D spaces, i.e. a pose.
29 ///
30 /// From the point of view of the entity's coordinate system,
31 /// all components are applied in the inverse order they are listed here.
32 /// E.g. if both a translation and a max3x3 transform are present,
33 /// the 3x3 matrix is applied first, followed by the translation.
34 ///
35 /// Whenever you log this archetype, the state of the resulting transform relationship is fully reset to the new archetype.
36 /// This means that if you first log a transform with only a translation, and then log one with only a rotation,
37 /// it will be resolved to a transform with only a rotation.
38 /// (This is unlike how we usually apply latest-at semantics on an archetype where we take the latest state of any component independently)
39 ///
40 /// For transforms that affect only a single entity and do not propagate along the entity tree refer to `archetypes::InstancePoses3D`.
41 ///
42 /// ## Examples
43 ///
44 /// ### Variety of 3D transforms
45 /// ![image](https://static.rerun.io/transform3d_simple/141368b07360ce3fcb1553079258ae3f42bdb9ac/full.png)
46 ///
47 /// ```cpp
48 /// #include <rerun.hpp>
49 ///
50 /// constexpr float TAU = 6.28318530717958647692528676655900577f;
51 ///
52 /// int main() {
53 /// const auto rec = rerun::RecordingStream("rerun_example_transform3d");
54 /// rec.spawn().exit_on_failure();
55 ///
56 /// auto arrow =
57 /// rerun::Arrows3D::from_vectors({{0.0f, 1.0f, 0.0f}}).with_origins({{0.0f, 0.0f, 0.0f}});
58 ///
59 /// rec.log("base", arrow);
60 ///
61 /// rec.log("base/translated", rerun::Transform3D::from_translation({1.0f, 0.0f, 0.0f}));
62 /// rec.log("base/translated", arrow);
63 ///
64 /// rec.log(
65 /// "base/rotated_scaled",
66 /// rerun::Transform3D::from_rotation_scale(
67 /// rerun::RotationAxisAngle({0.0f, 0.0f, 1.0f}, rerun::Angle::radians(TAU / 8.0f)),
68 /// 2.0f
69 /// )
70 /// );
71 /// rec.log("base/rotated_scaled", arrow);
72 /// }
73 /// ```
74 ///
75 /// ### Transform hierarchy
76 /// ![image](https://static.rerun.io/transform_hierarchy/cb7be7a5a31fcb2efc02ba38e434849248f87554/full.png)
77 ///
78 /// ```cpp
79 /// #include <rerun.hpp>
80 ///
81 /// constexpr float TAU = 6.28318530717958647692528676655900577f;
82 ///
83 /// int main() {
84 /// const auto rec = rerun::RecordingStream("rerun_example_transform3d_hierarchy");
85 /// rec.spawn().exit_on_failure();
86 ///
87 /// // TODO(#5521): log two views as in the python example
88 ///
89 /// rec.set_time_duration_secs("sim_time", 0.0);
90 ///
91 /// // Planetary motion is typically in the XY plane.
92 /// rec.log_static("/", rerun::ViewCoordinates::RIGHT_HAND_Z_UP);
93 ///
94 /// // Setup points, all are in the center of their own space:
95 /// rec.log(
96 /// "sun",
97 /// rerun::Points3D({{0.0f, 0.0f, 0.0f}})
98 /// .with_radii({1.0f})
99 /// .with_colors({rerun::Color(255, 200, 10)})
100 /// );
101 /// rec.log(
102 /// "sun/planet",
103 /// rerun::Points3D({{0.0f, 0.0f, 0.0f}})
104 /// .with_radii({0.4f})
105 /// .with_colors({rerun::Color(40, 80, 200)})
106 /// );
107 /// rec.log(
108 /// "sun/planet/moon",
109 /// rerun::Points3D({{0.0f, 0.0f, 0.0f}})
110 /// .with_radii({0.15f})
111 /// .with_colors({rerun::Color(180, 180, 180)})
112 /// );
113 ///
114 /// // Draw fixed paths where the planet & moon move.
115 /// float d_planet = 6.0f;
116 /// float d_moon = 3.0f;
117 /// std::vector<std::array<float, 3>> planet_path, moon_path;
118 /// for (int i = 0; i <= 100; i++) {
119 /// float angle = static_cast<float>(i) * 0.01f * TAU;
120 /// float circle_x = std::sin(angle);
121 /// float circle_y = std::cos(angle);
122 /// planet_path.push_back({circle_x * d_planet, circle_y * d_planet, 0.0f});
123 /// moon_path.push_back({circle_x * d_moon, circle_y * d_moon, 0.0f});
124 /// }
125 /// rec.log("sun/planet_path", rerun::LineStrips3D(rerun::LineStrip3D(planet_path)));
126 /// rec.log("sun/planet/moon_path", rerun::LineStrips3D(rerun::LineStrip3D(moon_path)));
127 ///
128 /// // Movement via transforms.
129 /// for (int i = 0; i <6 * 120; i++) {
130 /// float time = static_cast<float>(i) / 120.0f;
131 /// rec.set_time_duration_secs("sim_time", time);
132 /// float r_moon = time * 5.0f;
133 /// float r_planet = time * 2.0f;
134 ///
135 /// rec.log(
136 /// "sun/planet",
137 /// rerun::Transform3D::from_translation_rotation(
138 /// {std::sin(r_planet) * d_planet, std::cos(r_planet) * d_planet, 0.0f},
139 /// rerun::RotationAxisAngle{
140 /// {1.0, 0.0f, 0.0f},
141 /// rerun::Angle::degrees(20.0f),
142 /// }
143 /// )
144 /// );
145 /// rec.log(
146 /// "sun/planet/moon",
147 /// rerun::Transform3D::from_translation(
148 /// {std::cos(r_moon) * d_moon, std::sin(r_moon) * d_moon, 0.0f}
149 /// )
150 /// .with_relation(rerun::components::TransformRelation::ChildFromParent)
151 /// );
152 /// }
153 /// }
154 /// ```
155 ///
156 /// ### Update a transform over time
157 /// ![image](https://static.rerun.io/transform3d_column_updates/80634e1c7c7a505387e975f25ea8b6bc1d4eb9db/full.png)
158 ///
159 /// ```cpp
160 /// #include <rerun.hpp>
161 ///
162 /// float truncated_radians(int deg) {
163 /// auto degf = static_cast<float>(deg);
164 /// const auto pi = 3.14159265358979323846f;
165 /// return static_cast<float>(static_cast<int>(degf * pi / 180.0f * 1000.0f)) / 1000.0f;
166 /// }
167 ///
168 /// int main() {
169 /// const auto rec = rerun::RecordingStream("rerun_example_transform3d_row_updates");
170 /// rec.spawn().exit_on_failure();
171 ///
172 /// rec.set_time_sequence("tick", 0);
173 /// rec.log(
174 /// "box",
175 /// rerun::Boxes3D::from_half_sizes({{4.f, 2.f, 1.0f}}).with_fill_mode(rerun::FillMode::Solid),
176 /// rerun::Transform3D().with_axis_length(10.0)
177 /// );
178 ///
179 /// for (int t = 0; t <100; t++) {
180 /// rec.set_time_sequence("tick", t + 1);
181 /// rec.log(
182 /// "box",
183 /// rerun::Transform3D()
184 /// .with_translation({0.0f, 0.0f, static_cast<float>(t) / 10.0f})
185 /// .with_rotation_axis_angle(rerun::RotationAxisAngle(
186 /// {0.0f, 1.0f, 0.0f},
187 /// rerun::Angle::radians(truncated_radians(t * 4))
188 /// ))
189 /// );
190 /// }
191 /// }
192 /// ```
193 ///
194 /// ### Update a transform over time, in a single operation
195 /// ![image](https://static.rerun.io/transform3d_column_updates/80634e1c7c7a505387e975f25ea8b6bc1d4eb9db/full.png)
196 ///
197 /// ```cpp
198 /// #include <cmath>
199 /// #include <numeric>
200 /// #include <vector>
201 ///
202 /// #include <rerun.hpp>
203 ///
204 /// float truncated_radians(int deg) {
205 /// auto degf = static_cast<float>(deg);
206 /// const auto pi = 3.14159265358979323846f;
207 /// return static_cast<float>(static_cast<int>(degf * pi / 180.0f * 1000.0f)) / 1000.0f;
208 /// }
209 ///
210 /// int main() {
211 /// const auto rec = rerun::RecordingStream("rerun_example_transform3d_column_updates");
212 /// rec.spawn().exit_on_failure();
213 ///
214 /// rec.set_time_sequence("tick", 0);
215 /// rec.log(
216 /// "box",
217 /// rerun::Boxes3D::from_half_sizes({{4.f, 2.f, 1.0f}}).with_fill_mode(rerun::FillMode::Solid),
218 /// rerun::Transform3D().with_axis_length(10.0)
219 /// );
220 ///
221 /// std::vector<std::array<float, 3>> translations;
222 /// std::vector<rerun::RotationAxisAngle> rotations;
223 /// for (int t = 0; t <100; t++) {
224 /// translations.push_back({0.0f, 0.0f, static_cast<float>(t) / 10.0f});
225 /// rotations.push_back(rerun::RotationAxisAngle(
226 /// {0.0f, 1.0f, 0.0f},
227 /// rerun::Angle::radians(truncated_radians(t * 4))
228 /// ));
229 /// }
230 ///
231 /// std::vector<int64_t> ticks(100);
232 /// std::iota(ticks.begin(), ticks.end(), 1);
233 ///
234 /// rec.send_columns(
235 /// "box",
236 /// rerun::TimeColumn::from_sequence("tick", ticks),
237 /// rerun::Transform3D()
238 /// .with_many_translation(translations)
239 /// .with_many_rotation_axis_angle(rotations)
240 /// .columns()
241 /// );
242 /// }
243 /// ```
244 ///
245 /// ### Update specific properties of a transform over time
246 /// ![image](https://static.rerun.io/transform3d_partial_updates/11815bebc69ae400847896372b496cdd3e9b19fb/full.png)
247 ///
248 /// ```cpp
249 /// #include <rerun.hpp>
250 ///
251 /// float truncated_radians(int deg) {
252 /// auto degf = static_cast<float>(deg);
253 /// const auto pi = 3.14159265358979323846f;
254 /// return static_cast<float>(static_cast<int>(degf * pi / 180.0f * 1000.0f)) / 1000.0f;
255 /// }
256 ///
257 /// int main() {
258 /// const auto rec = rerun::RecordingStream("rerun_example_transform3d_partial_updates");
259 /// rec.spawn().exit_on_failure();
260 ///
261 /// // Set up a 3D box.
262 /// rec.log(
263 /// "box",
264 /// rerun::Boxes3D::from_half_sizes({{4.f, 2.f, 1.0f}}).with_fill_mode(rerun::FillMode::Solid),
265 /// rerun::Transform3D().with_axis_length(10.0)
266 /// );
267 ///
268 /// // Update only the rotation of the box.
269 /// for (int deg = 0; deg <= 45; deg++) {
270 /// auto rad = truncated_radians(deg * 4);
271 /// rec.log(
272 /// "box",
273 /// rerun::Transform3D::from_rotation(
274 /// rerun::RotationAxisAngle({0.0f, 1.0f, 0.0f}, rerun::Angle::radians(rad))
275 /// )
276 /// );
277 /// }
278 ///
279 /// // Update only the position of the box.
280 /// for (int t = 0; t <= 50; t++) {
281 /// rec.log(
282 /// "box",
283 /// rerun::Transform3D::from_translation({0.0f, 0.0f, static_cast<float>(t) / 10.0f})
284 /// );
285 /// }
286 ///
287 /// // Update only the rotation of the box.
288 /// for (int deg = 0; deg <= 45; deg++) {
289 /// auto rad = truncated_radians((deg + 45) * 4);
290 /// rec.log(
291 /// "box",
292 /// rerun::Transform3D::from_rotation(
293 /// rerun::RotationAxisAngle({0.0f, 1.0f, 0.0f}, rerun::Angle::radians(rad))
294 /// )
295 /// );
296 /// }
297 ///
298 /// // Clear all of the box's attributes, and reset its axis length.
299 /// rec.log("box", rerun::Transform3D::clear_fields().with_axis_length(15.0));
300 /// }
301 /// ```
302 struct Transform3D {
303 /// Translation vector.
304 ///
305 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
306 std::optional<ComponentBatch> translation;
307
308 /// Rotation via axis + angle.
309 ///
310 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
311 std::optional<ComponentBatch> rotation_axis_angle;
312
313 /// Rotation via quaternion.
314 ///
315 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
316 std::optional<ComponentBatch> quaternion;
317
318 /// Scaling factor.
319 ///
320 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
321 std::optional<ComponentBatch> scale;
322
323 /// 3x3 transformation matrix.
324 ///
325 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
326 std::optional<ComponentBatch> mat3x3;
327
328 /// Specifies the relation this transform establishes between this entity and its parent.
329 ///
330 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
331 std::optional<ComponentBatch> relation;
332
333 /// The child frame this transform transforms from.
334 ///
335 /// The entity at which the transform relationship of any given child frame is specified mustn't change over time.
336 /// E.g. if you specified the child frame `"robot_arm"` on an entity named `"my_transforms"`, you may not log transforms
337 /// with the child frame `"robot_arm"` on any other entity than `"my_transforms"`.
338 ///
339 /// ⚠ This currently also affects the child frame of `archetypes::Pinhole`.
340 /// ⚠ This currently is also used as the frame id of `archetypes::InstancePoses3D`.
341 ///
342 /// If not specified, this is set to the implicit transform frame of the current entity path.
343 /// This means that if a `archetypes::Transform3D` is set on an entity called `/my/entity/path` then this will default to `tf#/my/entity/path`.
344 ///
345 /// To set the frame an entity is part of see `archetypes::CoordinateFrame`.
346 ///
347 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
348 std::optional<ComponentBatch> child_frame;
349
350 /// The parent frame this transform transforms into.
351 ///
352 /// ⚠ This currently also affects the parent frame of `archetypes::Pinhole`.
353 ///
354 /// If not specified, this is set to the implicit transform frame of the current entity path's parent.
355 /// This means that if a `archetypes::Transform3D` is set on an entity called `/my/entity/path` then this will default to `tf#/my/entity`.
356 ///
357 /// To set the frame an entity is part of see `archetypes::CoordinateFrame`.
358 ///
359 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
360 std::optional<ComponentBatch> parent_frame;
361
362 /// Visual length of the 3 axes.
363 ///
364 /// The length is interpreted in the local coordinate system of the transform.
365 /// If the transform is scaled, the axes will be scaled accordingly.
366 std::optional<ComponentBatch> axis_length;
367
368 public:
369 /// The name of the archetype as used in `ComponentDescriptor`s.
370 static constexpr const char ArchetypeName[] = "rerun.archetypes.Transform3D";
371
372 /// `ComponentDescriptor` for the `translation` field.
374 ArchetypeName, "Transform3D:translation",
376 );
377 /// `ComponentDescriptor` for the `rotation_axis_angle` field.
379 ArchetypeName, "Transform3D:rotation_axis_angle",
381 );
382 /// `ComponentDescriptor` for the `quaternion` field.
384 ArchetypeName, "Transform3D:quaternion",
386 );
387 /// `ComponentDescriptor` for the `scale` field.
388 static constexpr auto Descriptor_scale = ComponentDescriptor(
390 );
391 /// `ComponentDescriptor` for the `mat3x3` field.
392 static constexpr auto Descriptor_mat3x3 = ComponentDescriptor(
393 ArchetypeName, "Transform3D:mat3x3",
395 );
396 /// `ComponentDescriptor` for the `relation` field.
398 ArchetypeName, "Transform3D:relation",
400 );
401 /// `ComponentDescriptor` for the `child_frame` field.
403 ArchetypeName, "Transform3D:child_frame",
405 );
406 /// `ComponentDescriptor` for the `parent_frame` field.
408 ArchetypeName, "Transform3D:parent_frame",
410 );
411 /// `ComponentDescriptor` for the `axis_length` field.
413 ArchetypeName, "Transform3D:axis_length",
415 );
416
417 public: // START of extensions from transform3d_ext.cpp:
418 /// Identity transformation.
419 ///
420 /// Applying this transform does not alter an entity's transformation.
421 RERUN_SDK_EXPORT static const Transform3D IDENTITY;
422
423 /// Invalid transformation.
424 ///
425 /// Applying this transform will cause this entity and the entire subtree not to be visualized.
426 RERUN_SDK_EXPORT static const Transform3D INVALID;
427
428 /// Creates a new 3D transform from translation and matrix provided as 3 columns.
429 /// Clears out all other components like `Transform3D::clear_fields`.
430 ///
431 /// \param translation_ \çopydoc Transform3D::translation
432 /// \param columns Column vectors of 3x3 matrix.
433 /// \param from_parent If true, the transform relation to `TransformRelation::ChildFromParent`.
434 ///
435 /// _Implementation note:_ This overload is necessary, otherwise the array may be
436 /// interpreted as bool and call the wrong overload.
438 const components::Translation3D& translation_, const datatypes::Vec3D (&columns)[3],
439 bool from_parent = false
440 )
441 : Transform3D(translation_, components::TransformMat3x3(columns), from_parent) {}
442
443 /// Creates a new 3D transform from translation/matrix.
444 /// Clears out all other components like `Transform3D::clear_fields`.
445 ///
446 /// \param translation_ \çopydoc Transform3D::translation
447 /// \param mat3x3_ \copydoc Transform3D::mat3x3
448 /// \param from_parent If true, the transform relation to `TransformRelation::ChildFromParent`.
450 const components::Translation3D& translation_,
451 const components::TransformMat3x3& mat3x3_, bool from_parent = false
452 ) {
453 *this = Transform3D().with_translation(translation_).with_mat3x3(mat3x3_);
454 if (from_parent) {
455 *this =
457 }
458 }
459
460 /// From a translation applied after a 3x3 matrix.
461 /// Clears out all other components like `Transform3D::clear_fields`.
462 ///
463 /// \param translation \çopydoc Transform3D::translation
464 /// \param mat3x3 \copydoc Transform3D::mat3x3
467 ) {
468 return Transform3D(translation, mat3x3, false);
469 }
470
471 /// From a translation applied after a 3x3 matrix provided as 3 columns.
472 /// Clears out all other components like `Transform3D::clear_fields`.
473 ///
474 /// \param translation \çopydoc Transform3D::translation
475 /// \param columns Column vectors of 3x3 matrix.
478 ) {
482 );
483 }
484
485 /// From translation only.
486 /// Clears out all other components like `Transform3D::clear_fields`.
487 ///
488 /// \param translation_ \çopydoc Transform3D::translation
489 /// \param from_parent If true, the transform relation to `TransformRelation::ChildFromParent`.
490 Transform3D(const components::Translation3D& translation_, bool from_parent = false) {
491 *this = Transform3D().with_translation(translation_);
492 if (from_parent) {
493 *this =
495 }
496 }
497
498 /// From a translation.
499 /// Clears out all other components like `Transform3D::clear_fields`.
500 ///
501 /// \param translation \çopydoc Transform3D::translation
503 return Transform3D(translation, false);
504 }
505
506 /// From 3x3 matrix only.
507 /// Clears out all other components like `Transform3D::clear_fields`.
508 ///
509 /// \param mat3x3_ \copydoc Transform3D::mat3x3
510 /// \param from_parent If true, the transform relation to `TransformRelation::ChildFromParent`.
511 Transform3D(const components::TransformMat3x3& mat3x3_, bool from_parent = false) {
512 *this = Transform3D().with_mat3x3(mat3x3_);
513 if (from_parent) {
514 *this =
516 }
517 }
518
519 /// From 3x3 matrix only.
520 /// Clears out all other components like `Transform3D::clear_fields`.
521 ///
522 /// \param mat3x3 \copydoc Transform3D::mat3x3
524 return Transform3D(mat3x3, false);
525 }
526
527 /// From 3x3 matrix provided as 3 columns only.
528 /// Clears out all other components like `Transform3D::clear_fields`.
529 ///
530 /// \param columns Column vectors of 3x3 matrix.
531 /// \param from_parent If true, the transform relation to `TransformRelation::ChildFromParent`.
532 Transform3D(const datatypes::Vec3D (&columns)[3], bool from_parent = false)
533 : Transform3D(components::TransformMat3x3(columns), from_parent) {}
534
535 /// From 3x3 matrix provided as 3 columns only.
536 /// Clears out all other components like `Transform3D::clear_fields`.
537 ///
538 /// \param columns Column vectors of 3x3 matrix.
541 }
542
543 /// Creates a new 3D transform from translation/rotation/scale.
544 /// Clears out all other components like `Transform3D::clear_fields`.
545 ///
546 /// \param translation_ \copydoc Transform3D::translation
547 /// \param rotation Rotation represented either as a quaternion or axis + angle rotation.
548 /// \param scale_ \copydoc Transform3D::scale
549 /// \param from_parent If true, the transform relation to `TransformRelation::ChildFromParent`.
551 const components::Translation3D& translation_, const Rotation3D& rotation,
552 const components::Scale3D& scale_, bool from_parent = false
553 ) {
554 *this = Transform3D()
555 .with_translation(translation_)
556 .with_scale(scale_)
557 .with_rotation(rotation);
558 if (from_parent) {
559 *this =
561 }
562 }
563
564 /// Creates a new 3D transform from translation/rotation/uniform-scale.
565 /// Clears out all other components like `Transform3D::clear_fields`.
566 ///
567 /// \param translation_ \copydoc Transform3D::translation
568 /// \param rotation Rotation represented either as a quaternion or axis + angle rotation.
569 /// \param uniform_scale Uniform scale factor that is applied to all axis equally.
570 /// \param from_parent If true, the transform relation to `TransformRelation::ChildFromParent`.
571 ///
572 /// _Implementation note:_ This explicit overload prevents interpretation of the float as
573 /// bool, leading to a call to the wrong overload.
575 const components::Translation3D& translation_, const Rotation3D& rotation,
576 float uniform_scale, bool from_parent = false
577 )
578 : Transform3D(translation_, rotation, components::Scale3D(uniform_scale), from_parent) {
579 }
580
581 /// From a translation, applied after a rotation & scale, known as an affine transformation.
582 /// Clears out all other components like `Transform3D::clear_fields`.
583 ///
584 /// \param translation \copydoc Transform3D::translation
585 /// \param rotation Rotation represented either as a quaternion or axis + angle rotation.
586 /// \param scale \copydoc Transform3D::scale
588 const components::Translation3D& translation, const Rotation3D& rotation,
590 ) {
591 return Transform3D(translation, rotation, scale, false);
592 }
593
594 /// From a translation, applied after a rotation & scale, known as an affine transformation.
595 /// Clears out all other components like `Transform3D::clear_fields`.
596 ///
597 /// \param translation \copydoc Transform3D::translation
598 /// \param rotation Rotation represented either as a quaternion or axis + angle rotation.
599 /// \param uniform_scale Uniform scale factor that is applied to all axis equally.
601 const components::Translation3D& translation, const Rotation3D& rotation,
602 float uniform_scale
603 ) {
604 return Transform3D(translation, rotation, components::Scale3D(uniform_scale), false);
605 }
606
607 /// Creates a new rigid transform (translation & rotation only).
608 /// Clears out all other components like `Transform3D::clear_fields`.
609 ///
610 /// \param translation_ \copydoc Transform3D::translation
611 /// \param rotation Rotation represented either as a quaternion or axis + angle rotation.
612 /// \param from_parent If true, the transform relation to `TransformRelation::ChildFromParent`.
614 const components::Translation3D& translation_, const Rotation3D& rotation,
615 bool from_parent = false
616 ) {
617 *this = Transform3D().with_translation(translation_).with_rotation(rotation);
618 if (from_parent) {
619 *this =
621 }
622 }
623
624 /// From a rotation & scale.
625 /// Clears out all other components like `Transform3D::clear_fields`.
626 ///
627 /// \param translation \copydoc Transform3D::translation
628 /// \param rotation Rotation represented either as a quaternion or axis + angle rotation.
630 const components::Translation3D& translation, const Rotation3D& rotation
631 ) {
632 return Transform3D(translation, rotation, false);
633 }
634
635 /// From translation & scale only.
636 /// Clears out all other components like `Transform3D::clear_fields`.
637 ///
638 /// \param translation_ \copydoc Transform3D::translation
639 /// \param scale_ Transform3D::scale
640 /// \param from_parent If true, the transform relation to `TransformRelation::ChildFromParent`.
642 const components::Translation3D& translation_, const components::Scale3D& scale_,
643 bool from_parent = false
644 ) {
645 *this = Transform3D().with_translation(translation_).with_scale(scale_);
646 if (from_parent) {
647 *this =
649 }
650 }
651
652 /// From a translation applied after a scale.
653 /// Clears out all other components like `Transform3D::clear_fields`.
654 ///
655 /// \param translation \copydoc Transform3D::translation
656 /// \param scale Transform3D::scale
659 ) {
660 return Transform3D(translation, scale, false);
661 }
662
663 /// From translation & uniform scale only.
664 /// Clears out all other components like `Transform3D::clear_fields`.
665 ///
666 /// \param translation_ \copydoc Transform3D::translation
667 /// \param uniform_scale Uniform scale factor that is applied to all axis equally.
668 /// \param from_parent If true, the transform relation to `TransformRelation::ChildFromParent`.
669 ///
670 /// _Implementation note:_ This explicit overload prevents interpretation of the float as
671 /// bool, leading to a call to the wrong overload.
673 const components::Translation3D& translation_, float uniform_scale,
674 bool from_parent = false
675 )
676 : Transform3D(translation_, components::Scale3D(uniform_scale), from_parent) {}
677
678 /// From rotation & scale.
679 /// Clears out all other components like `Transform3D::clear_fields`.
680 ///
681 /// \param rotation Rotation represented either as a quaternion or axis + angle rotation.
682 /// \param scale_ Transform3D::scale
683 /// \param from_parent If true, the transform relation to `TransformRelation::ChildFromParent`.
685 const Rotation3D& rotation, const components::Scale3D& scale_, bool from_parent = false
686 ) {
687 *this = Transform3D().with_scale(scale_).with_rotation(rotation);
688 if (from_parent) {
689 *this =
691 }
692 }
693
694 /// From rotation & uniform scale.
695 /// Clears out all other components like `Transform3D::clear_fields`.
696 ///
697 /// \param rotation Rotation represented either as a quaternion or axis + angle rotation.
698 /// \param uniform_scale Uniform scale factor that is applied to all axis equally.
699 /// \param from_parent If true, the transform relation to `TransformRelation::ChildFromParent`.
700 ///
701 /// _Implementation note:_ This explicit overload prevents interpretation of the float as
702 /// bool, leading to a call to the wrong overload.
703 Transform3D(const Rotation3D& rotation, float uniform_scale, bool from_parent = false)
704 : Transform3D(rotation, components::Scale3D(uniform_scale), from_parent) {}
705
706 /// From a rotation & scale.
707 /// Clears out all other components like `Transform3D::clear_fields`.
708 ///
709 /// \param rotation Rotation represented either as a quaternion or axis + angle rotation.
710 /// \param scale Transform3D::scale
712 const Rotation3D& rotation, const components::Scale3D& scale
713 ) {
714 return Transform3D(rotation, scale, false);
715 }
716
717 /// From a rotation & uniform scale.
718 /// Clears out all other components like `Transform3D::clear_fields`.
719 ///
720 /// \param rotation Rotation represented either as a quaternion or axis + angle rotation.
721 /// \param uniform_scale Uniform scale factor that is applied to all axis equally.
722 static Transform3D from_rotation_scale(const Rotation3D& rotation, float uniform_scale) {
723 return Transform3D(rotation, components::Scale3D(uniform_scale), false);
724 }
725
726 /// From rotation only.
727 /// Clears out all other components like `Transform3D::clear_fields`.
728 ///
729 /// \param rotation Rotation represented either as a quaternion or axis + angle rotation.
730 /// \param from_parent If true, the transform relation to `TransformRelation::ChildFromParent`.
731 Transform3D(const Rotation3D& rotation, bool from_parent = false) {
732 *this = Transform3D().with_rotation(rotation);
733 if (from_parent) {
734 *this =
736 }
737 }
738
739 /// From rotation only.
740 /// Clears out all other components like `Transform3D::clear_fields`.
741 ///
742 /// \param rotation Rotation represented either as a quaternion or axis + angle rotation.
743 static Transform3D from_rotation(const Rotation3D& rotation) {
744 return Transform3D(rotation, false);
745 }
746
747 /// From scale only.
748 /// Clears out all other components like `Transform3D::clear_fields`.
749 ///
750 /// \param scale_ If true, the transform relation to `TransformRelation::ChildFromParent`.
751 /// \param from_parent \copydoc Transform3D::scale
752 Transform3D(const components::Scale3D& scale_, bool from_parent = false) {
753 *this = Transform3D().with_scale(scale_);
754 if (from_parent) {
755 *this =
757 }
758 }
759
760 /// From scale only.
761 /// Clears out all other components like `Transform3D::clear_fields`.
762 ///
763 /// \param scale Transform3D::scale
765 return Transform3D(scale, false);
766 }
767
768 /// From scale only.
769 /// Clears out all other components like `Transform3D::clear_fields`.
770 ///
771 /// \param uniform_scale Uniform scale factor that is applied to all axis equally.
772 static Transform3D from_scale(float uniform_scale) {
773 return Transform3D(components::Scale3D(uniform_scale), false);
774 }
775
776 /// Set the rotation component of the transform using the `rerun::Rotation3D` utility.
778 if (rotation.axis_angle.has_value()) {
779 *this = std::move(*this).with_rotation_axis_angle(rotation.axis_angle.value());
780 }
781 if (rotation.quaternion.has_value()) {
782 *this = std::move(*this).with_quaternion(rotation.quaternion.value());
783 }
784 return std::move(*this);
785 }
786
787 // END of extensions from transform3d_ext.cpp, start of generated code:
788
789 public:
790 Transform3D() = default;
791 Transform3D(Transform3D&& other) = default;
792 Transform3D(const Transform3D& other) = default;
793 Transform3D& operator=(const Transform3D& other) = default;
794 Transform3D& operator=(Transform3D&& other) = default;
795
796 /// Update only some specific fields of a `Transform3D`.
798 return Transform3D();
799 }
800
801 /// Clear all the fields of a `Transform3D`.
803
804 /// Translation vector.
805 ///
806 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
809 .value_or_throw();
810 return std::move(*this);
811 }
812
813 /// This method makes it possible to pack multiple `translation` in a single component batch.
814 ///
815 /// This only makes sense when used in conjunction with `columns`. `with_translation` should
816 /// be used when logging a single row's worth of data.
819 ) && {
821 .value_or_throw();
822 return std::move(*this);
823 }
824
825 /// Rotation via axis + angle.
826 ///
827 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
829 const rerun::components::RotationAxisAngle& _rotation_axis_angle
830 ) && {
833 .value_or_throw();
834 return std::move(*this);
835 }
836
837 /// This method makes it possible to pack multiple `rotation_axis_angle` in a single component batch.
838 ///
839 /// This only makes sense when used in conjunction with `columns`. `with_rotation_axis_angle` should
840 /// be used when logging a single row's worth of data.
842 const Collection<rerun::components::RotationAxisAngle>& _rotation_axis_angle
843 ) && {
846 .value_or_throw();
847 return std::move(*this);
848 }
849
850 /// Rotation via quaternion.
851 ///
852 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
854 quaternion =
855 ComponentBatch::from_loggable(_quaternion, Descriptor_quaternion).value_or_throw();
856 return std::move(*this);
857 }
858
859 /// This method makes it possible to pack multiple `quaternion` in a single component batch.
860 ///
861 /// This only makes sense when used in conjunction with `columns`. `with_quaternion` should
862 /// be used when logging a single row's worth of data.
865 ) && {
866 quaternion =
867 ComponentBatch::from_loggable(_quaternion, Descriptor_quaternion).value_or_throw();
868 return std::move(*this);
869 }
870
871 /// Scaling factor.
872 ///
873 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
875 scale = ComponentBatch::from_loggable(_scale, Descriptor_scale).value_or_throw();
876 return std::move(*this);
877 }
878
879 /// This method makes it possible to pack multiple `scale` in a single component batch.
880 ///
881 /// This only makes sense when used in conjunction with `columns`. `with_scale` should
882 /// be used when logging a single row's worth of data.
884 scale = ComponentBatch::from_loggable(_scale, Descriptor_scale).value_or_throw();
885 return std::move(*this);
886 }
887
888 /// 3x3 transformation matrix.
889 ///
890 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
892 mat3x3 = ComponentBatch::from_loggable(_mat3x3, Descriptor_mat3x3).value_or_throw();
893 return std::move(*this);
894 }
895
896 /// This method makes it possible to pack multiple `mat3x3` in a single component batch.
897 ///
898 /// This only makes sense when used in conjunction with `columns`. `with_mat3x3` should
899 /// be used when logging a single row's worth of data.
901 ) && {
902 mat3x3 = ComponentBatch::from_loggable(_mat3x3, Descriptor_mat3x3).value_or_throw();
903 return std::move(*this);
904 }
905
906 /// Specifies the relation this transform establishes between this entity and its parent.
907 ///
908 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
910 relation =
911 ComponentBatch::from_loggable(_relation, Descriptor_relation).value_or_throw();
912 return std::move(*this);
913 }
914
915 /// This method makes it possible to pack multiple `relation` in a single component batch.
916 ///
917 /// This only makes sense when used in conjunction with `columns`. `with_relation` should
918 /// be used when logging a single row's worth of data.
921 ) && {
922 relation =
923 ComponentBatch::from_loggable(_relation, Descriptor_relation).value_or_throw();
924 return std::move(*this);
925 }
926
927 /// The child frame this transform transforms from.
928 ///
929 /// The entity at which the transform relationship of any given child frame is specified mustn't change over time.
930 /// E.g. if you specified the child frame `"robot_arm"` on an entity named `"my_transforms"`, you may not log transforms
931 /// with the child frame `"robot_arm"` on any other entity than `"my_transforms"`.
932 ///
933 /// ⚠ This currently also affects the child frame of `archetypes::Pinhole`.
934 /// ⚠ This currently is also used as the frame id of `archetypes::InstancePoses3D`.
935 ///
936 /// If not specified, this is set to the implicit transform frame of the current entity path.
937 /// This means that if a `archetypes::Transform3D` is set on an entity called `/my/entity/path` then this will default to `tf#/my/entity/path`.
938 ///
939 /// To set the frame an entity is part of see `archetypes::CoordinateFrame`.
940 ///
941 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
944 .value_or_throw();
945 return std::move(*this);
946 }
947
948 /// This method makes it possible to pack multiple `child_frame` in a single component batch.
949 ///
950 /// This only makes sense when used in conjunction with `columns`. `with_child_frame` should
951 /// be used when logging a single row's worth of data.
954 ) && {
956 .value_or_throw();
957 return std::move(*this);
958 }
959
960 /// The parent frame this transform transforms into.
961 ///
962 /// ⚠ This currently also affects the parent frame of `archetypes::Pinhole`.
963 ///
964 /// If not specified, this is set to the implicit transform frame of the current entity path's parent.
965 /// This means that if a `archetypes::Transform3D` is set on an entity called `/my/entity/path` then this will default to `tf#/my/entity`.
966 ///
967 /// To set the frame an entity is part of see `archetypes::CoordinateFrame`.
968 ///
969 /// Any update to this field will reset all other transform properties that aren't changed in the same log call or `send_columns` row.
972 .value_or_throw();
973 return std::move(*this);
974 }
975
976 /// This method makes it possible to pack multiple `parent_frame` in a single component batch.
977 ///
978 /// This only makes sense when used in conjunction with `columns`. `with_parent_frame` should
979 /// be used when logging a single row's worth of data.
982 ) && {
984 .value_or_throw();
985 return std::move(*this);
986 }
987
988 /// Visual length of the 3 axes.
989 ///
990 /// The length is interpreted in the local coordinate system of the transform.
991 /// If the transform is scaled, the axes will be scaled accordingly.
994 .value_or_throw();
995 return std::move(*this);
996 }
997
998 /// This method makes it possible to pack multiple `axis_length` in a single component batch.
999 ///
1000 /// This only makes sense when used in conjunction with `columns`. `with_axis_length` should
1001 /// be used when logging a single row's worth of data.
1004 ) && {
1006 .value_or_throw();
1007 return std::move(*this);
1008 }
1009
1010 /// Partitions the component data into multiple sub-batches.
1011 ///
1012 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
1013 /// instead, via `ComponentBatch::partitioned`.
1014 ///
1015 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
1016 ///
1017 /// The specified `lengths` must sum to the total length of the component batch.
1019
1020 /// Partitions the component data into unit-length sub-batches.
1021 ///
1022 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
1023 /// where `n` is automatically guessed.
1025 };
1026
1027} // namespace rerun::archetypes
1028
1029namespace rerun {
1030 /// \private
1031 template <typename T>
1032 struct AsComponents;
1033
1034 /// \private
1035 template <>
1036 struct AsComponents<archetypes::Transform3D> {
1037 /// Serialize all set component batches.
1038 static Result<Collection<ComponentBatch>> as_batches(
1039 const archetypes::Transform3D& archetype
1040 );
1041 };
1042} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
A class for representing either a usable value, or an error.
Definition result.hpp:14
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:76
TransformRelation
Component: Specifies relation a spatial transform describes.
Definition transform_relation.hpp:24
@ ChildFromParent
The transform describes how to transform into the child entity's space.
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:16
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Utility for representing a single 3D rotation, agnostic to the underlying representation.
Definition rotation3d.hpp:14
Archetype: A transform between two 3D spaces, i.e.
Definition transform3d.hpp:302
static constexpr auto Descriptor_rotation_axis_angle
ComponentDescriptor for the rotation_axis_angle field.
Definition transform3d.hpp:378
static RERUN_SDK_EXPORT const Transform3D IDENTITY
Identity transformation.
Definition transform3d.hpp:421
std::optional< ComponentBatch > parent_frame
The parent frame this transform transforms into.
Definition transform3d.hpp:360
std::optional< ComponentBatch > mat3x3
3x3 transformation matrix.
Definition transform3d.hpp:326
Transform3D with_many_axis_length(const Collection< rerun::components::AxisLength > &_axis_length) &&
This method makes it possible to pack multiple axis_length in a single component batch.
Definition transform3d.hpp:1002
Transform3D(const datatypes::Vec3D(&columns)[3], bool from_parent=false)
From 3x3 matrix provided as 3 columns only.
Definition transform3d.hpp:532
Transform3D(const components::Translation3D &translation_, const components::TransformMat3x3 &mat3x3_, bool from_parent=false)
Creates a new 3D transform from translation/matrix.
Definition transform3d.hpp:449
std::optional< ComponentBatch > child_frame
The child frame this transform transforms from.
Definition transform3d.hpp:348
static Transform3D from_translation_scale(const components::Translation3D &translation, const components::Scale3D &scale)
From a translation applied after a scale.
Definition transform3d.hpp:657
Transform3D with_relation(const rerun::components::TransformRelation &_relation) &&
Specifies the relation this transform establishes between this entity and its parent.
Definition transform3d.hpp:909
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.
Definition transform3d.hpp:574
std::optional< ComponentBatch > axis_length
Visual length of the 3 axes.
Definition transform3d.hpp:366
static Transform3D from_mat3x3(const components::TransformMat3x3 &mat3x3)
From 3x3 matrix only.
Definition transform3d.hpp:523
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.
Definition transform3d.hpp:550
Transform3D(const Rotation3D &rotation, float uniform_scale, bool from_parent=false)
From rotation & uniform scale.
Definition transform3d.hpp:703
Transform3D(const components::Translation3D &translation_, float uniform_scale, bool from_parent=false)
From translation & uniform scale only.
Definition transform3d.hpp:672
Transform3D with_scale(const rerun::components::Scale3D &_scale) &&
Scaling factor.
Definition transform3d.hpp:874
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
static constexpr auto Descriptor_child_frame
ComponentDescriptor for the child_frame field.
Definition transform3d.hpp:402
static RERUN_SDK_EXPORT const Transform3D INVALID
Invalid transformation.
Definition transform3d.hpp:426
Transform3D with_many_child_frame(const Collection< rerun::components::TransformFrameId > &_child_frame) &&
This method makes it possible to pack multiple child_frame in a single component batch.
Definition transform3d.hpp:952
Transform3D with_quaternion(const rerun::components::RotationQuat &_quaternion) &&
Rotation via quaternion.
Definition transform3d.hpp:853
std::optional< ComponentBatch > translation
Translation vector.
Definition transform3d.hpp:306
Transform3D(const components::Translation3D &translation_, const Rotation3D &rotation, bool from_parent=false)
Creates a new rigid transform (translation & rotation only).
Definition transform3d.hpp:613
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.
Definition transform3d.hpp:437
Transform3D with_translation(const rerun::components::Translation3D &_translation) &&
Translation vector.
Definition transform3d.hpp:807
Transform3D(const Rotation3D &rotation, bool from_parent=false)
From rotation only.
Definition transform3d.hpp:731
Transform3D(const components::TransformMat3x3 &mat3x3_, bool from_parent=false)
From 3x3 matrix only.
Definition transform3d.hpp:511
Transform3D with_axis_length(const rerun::components::AxisLength &_axis_length) &&
Visual length of the 3 axes.
Definition transform3d.hpp:992
static Transform3D update_fields()
Update only some specific fields of a Transform3D.
Definition transform3d.hpp:797
static Transform3D from_rotation_scale(const Rotation3D &rotation, float uniform_scale)
From a rotation & uniform scale.
Definition transform3d.hpp:722
static Transform3D from_translation_mat3x3(const components::Translation3D &translation, const components::TransformMat3x3 &mat3x3)
From a translation applied after a 3x3 matrix.
Definition transform3d.hpp:465
static Transform3D from_rotation_scale(const Rotation3D &rotation, const components::Scale3D &scale)
From a rotation & scale.
Definition transform3d.hpp:711
static Transform3D from_translation(const components::Translation3D &translation)
From a translation.
Definition transform3d.hpp:502
static constexpr auto Descriptor_axis_length
ComponentDescriptor for the axis_length field.
Definition transform3d.hpp:412
Transform3D with_rotation(const Rotation3D &rotation) &&
Set the rotation component of the transform using the rerun::Rotation3D utility.
Definition transform3d.hpp:777
static Transform3D from_scale(float uniform_scale)
From scale only.
Definition transform3d.hpp:772
std::optional< ComponentBatch > rotation_axis_angle
Rotation via axis + angle.
Definition transform3d.hpp:311
Transform3D with_many_mat3x3(const Collection< rerun::components::TransformMat3x3 > &_mat3x3) &&
This method makes it possible to pack multiple mat3x3 in a single component batch.
Definition transform3d.hpp:900
static constexpr auto Descriptor_translation
ComponentDescriptor for the translation field.
Definition transform3d.hpp:373
Transform3D with_many_rotation_axis_angle(const Collection< rerun::components::RotationAxisAngle > &_rotation_axis_angle) &&
This method makes it possible to pack multiple rotation_axis_angle in a single component batch.
Definition transform3d.hpp:841
static constexpr auto Descriptor_quaternion
ComponentDescriptor for the quaternion field.
Definition transform3d.hpp:383
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.
Definition transform3d.hpp:587
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition transform3d.hpp:370
static constexpr auto Descriptor_parent_frame
ComponentDescriptor for the parent_frame field.
Definition transform3d.hpp:407
static constexpr auto Descriptor_scale
ComponentDescriptor for the scale field.
Definition transform3d.hpp:388
Transform3D(const components::Scale3D &scale_, bool from_parent=false)
From scale only.
Definition transform3d.hpp:752
static constexpr auto Descriptor_mat3x3
ComponentDescriptor for the mat3x3 field.
Definition transform3d.hpp:392
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.
Definition transform3d.hpp:476
static Transform3D from_translation_rotation(const components::Translation3D &translation, const Rotation3D &rotation)
From a rotation & scale.
Definition transform3d.hpp:629
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
std::optional< ComponentBatch > quaternion
Rotation via quaternion.
Definition transform3d.hpp:316
Transform3D with_child_frame(const rerun::components::TransformFrameId &_child_frame) &&
The child frame this transform transforms from.
Definition transform3d.hpp:942
Transform3D(const Rotation3D &rotation, const components::Scale3D &scale_, bool from_parent=false)
From rotation & scale.
Definition transform3d.hpp:684
Transform3D with_many_relation(const Collection< rerun::components::TransformRelation > &_relation) &&
This method makes it possible to pack multiple relation in a single component batch.
Definition transform3d.hpp:919
Transform3D(const components::Translation3D &translation_, bool from_parent=false)
From translation only.
Definition transform3d.hpp:490
Transform3D with_many_quaternion(const Collection< rerun::components::RotationQuat > &_quaternion) &&
This method makes it possible to pack multiple quaternion in a single component batch.
Definition transform3d.hpp:863
Transform3D with_rotation_axis_angle(const rerun::components::RotationAxisAngle &_rotation_axis_angle) &&
Rotation via axis + angle.
Definition transform3d.hpp:828
Transform3D with_parent_frame(const rerun::components::TransformFrameId &_parent_frame) &&
The parent frame this transform transforms into.
Definition transform3d.hpp:970
Transform3D with_many_translation(const Collection< rerun::components::Translation3D > &_translation) &&
This method makes it possible to pack multiple translation in a single component batch.
Definition transform3d.hpp:817
Transform3D(const components::Translation3D &translation_, const components::Scale3D &scale_, bool from_parent=false)
From translation & scale only.
Definition transform3d.hpp:641
std::optional< ComponentBatch > relation
Specifies the relation this transform establishes between this entity and its parent.
Definition transform3d.hpp:331
static Transform3D clear_fields()
Clear all the fields of a Transform3D.
Transform3D with_many_scale(const Collection< rerun::components::Scale3D > &_scale) &&
This method makes it possible to pack multiple scale in a single component batch.
Definition transform3d.hpp:883
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.
Definition transform3d.hpp:600
Transform3D with_mat3x3(const rerun::components::TransformMat3x3 &_mat3x3) &&
3x3 transformation matrix.
Definition transform3d.hpp:891
static constexpr auto Descriptor_relation
ComponentDescriptor for the relation field.
Definition transform3d.hpp:397
static Transform3D from_scale(const components::Scale3D &scale)
From scale only.
Definition transform3d.hpp:764
static Transform3D from_mat3x3(const datatypes::Vec3D(&columns)[3])
From 3x3 matrix provided as 3 columns only.
Definition transform3d.hpp:539
std::optional< ComponentBatch > scale
Scaling factor.
Definition transform3d.hpp:321
static Transform3D from_rotation(const Rotation3D &rotation)
From rotation only.
Definition transform3d.hpp:743
Transform3D with_many_parent_frame(const Collection< rerun::components::TransformFrameId > &_parent_frame) &&
This method makes it possible to pack multiple parent_frame in a single component batch.
Definition transform3d.hpp:980
Component: The length of an axis in local units of the space.
Definition axis_length.hpp:14
Component: 3D rotation represented by a rotation around a given axis.
Definition rotation_axis_angle.hpp:17
Component: A 3D rotation expressed as a quaternion.
Definition rotation_quat.hpp:18
Component: A 3D scale factor.
Definition scale3d.hpp:19
Component: A string identifier for a transform frame.
Definition transform_frame_id.hpp:27
Component: A 3x3 transformation matrix Matrix.
Definition transform_mat3x3.hpp:27
Component: A translation vector in 3D space.
Definition translation3d.hpp:15
Datatype: A vector in 3D space.
Definition vec3d.hpp:20