Rerun C++ SDK
Loading...
Searching...
No Matches
transform_axes3d.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_sdk_types/definitions/rerun/archetypes/transform_axes3d.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../component_batch.hpp"
8#include "../component_column.hpp"
9#include "../components/axis_length.hpp"
10#include "../components/show_labels.hpp"
11#include "../result.hpp"
12
13#include <cstdint>
14#include <optional>
15#include <utility>
16#include <vector>
17
18namespace rerun::archetypes {
19 /// **Archetype**: A visual representation of a `archetypes::Transform3D`.
20 ///
21 /// ## Example
22 ///
23 /// ### Visual representation of a transform as three arrows
24 /// ![image](https://static.rerun.io/transform3d_axes/574c482088e9d317b19127fc8bef957dbfd3abe8/full.png)
25 ///
26 /// ```cpp
27 /// #include <rerun.hpp>
28 ///
29 /// int main(int argc, char* argv[]) {
30 /// const auto rec = rerun::RecordingStream("rerun_example_transform3d_axes");
31 /// rec.spawn().exit_on_failure();
32 ///
33 /// rec.set_time_sequence("step", 0);
34 ///
35 /// rec.log("base", rerun::Transform3D(), rerun::TransformAxes3D(1.0));
36 ///
37 /// for (int deg = 0; deg <360; deg++) {
38 /// rec.set_time_sequence("step", deg);
39 ///
40 /// rec.log(
41 /// "base/rotated",
42 /// rerun::Transform3D().with_rotation_axis_angle(
43 /// rerun::RotationAxisAngle(
44 /// {1.0f, 1.0f, 1.0f},
45 /// rerun::Angle::degrees(static_cast<float>(deg))
46 /// )
47 /// ),
48 /// rerun::TransformAxes3D(0.5)
49 /// );
50 ///
51 /// rec.log(
52 /// "base/rotated/translated",
53 /// rerun::Transform3D().with_translation({2.0f, 0.0f, 0.0f}),
54 /// rerun::TransformAxes3D(0.5)
55 /// );
56 /// }
57 /// }
58 /// ```
60 /// Visual length of the 3 axes.
61 ///
62 /// The length is interpreted in the local coordinate system of the transform.
63 /// If the transform is scaled, the axes will be scaled accordingly.
64 std::optional<ComponentBatch> axis_length;
65
66 /// Whether to show a text label with the corresponding frame.
67 std::optional<ComponentBatch> show_frame;
68
69 public:
70 /// The name of the archetype as used in `ComponentDescriptor`s.
71 static constexpr const char ArchetypeName[] = "rerun.archetypes.TransformAxes3D";
72
73 /// `ComponentDescriptor` for the `axis_length` field.
75 ArchetypeName, "TransformAxes3D:axis_length",
77 );
78 /// `ComponentDescriptor` for the `show_frame` field.
80 ArchetypeName, "TransformAxes3D:show_frame",
82 );
83
84 public:
85 TransformAxes3D() = default;
86 TransformAxes3D(TransformAxes3D&& other) = default;
87 TransformAxes3D(const TransformAxes3D& other) = default;
88 TransformAxes3D& operator=(const TransformAxes3D& other) = default;
89 TransformAxes3D& operator=(TransformAxes3D&& other) = default;
90
93 ComponentBatch::from_loggable(std::move(_axis_length), Descriptor_axis_length)
94 .value_or_throw()
95 ) {}
96
97 /// Update only some specific fields of a `TransformAxes3D`.
99 return TransformAxes3D();
100 }
101
102 /// Clear all the fields of a `TransformAxes3D`.
104
105 /// Visual length of the 3 axes.
106 ///
107 /// The length is interpreted in the local coordinate system of the transform.
108 /// If the transform is scaled, the axes will be scaled accordingly.
111 .value_or_throw();
112 return std::move(*this);
113 }
114
115 /// This method makes it possible to pack multiple `axis_length` in a single component batch.
116 ///
117 /// This only makes sense when used in conjunction with `columns`. `with_axis_length` should
118 /// be used when logging a single row's worth of data.
121 ) && {
123 .value_or_throw();
124 return std::move(*this);
125 }
126
127 /// Whether to show a text label with the corresponding frame.
129 show_frame =
130 ComponentBatch::from_loggable(_show_frame, Descriptor_show_frame).value_or_throw();
131 return std::move(*this);
132 }
133
134 /// This method makes it possible to pack multiple `show_frame` in a single component batch.
135 ///
136 /// This only makes sense when used in conjunction with `columns`. `with_show_frame` should
137 /// be used when logging a single row's worth of data.
140 ) && {
141 show_frame =
142 ComponentBatch::from_loggable(_show_frame, Descriptor_show_frame).value_or_throw();
143 return std::move(*this);
144 }
145
146 /// Partitions the component data into multiple sub-batches.
147 ///
148 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
149 /// instead, via `ComponentBatch::partitioned`.
150 ///
151 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
152 ///
153 /// The specified `lengths` must sum to the total length of the component batch.
155
156 /// Partitions the component data into unit-length sub-batches.
157 ///
158 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
159 /// where `n` is automatically guessed.
161 };
162
163} // namespace rerun::archetypes
164
165namespace rerun {
166 /// \private
167 template <typename T>
168 struct AsComponents;
169
170 /// \private
171 template <>
172 struct AsComponents<archetypes::TransformAxes3D> {
173 /// Serialize all set component batches.
174 static Result<Collection<ComponentBatch>> as_batches(
175 const archetypes::TransformAxes3D& archetype
176 );
177 };
178} // 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:87
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Arrow-encoded data of a single batch of components together with a component descriptor.
Definition component_batch.hpp:28
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
Archetype: A visual representation of a archetypes::Transform3D.
Definition transform_axes3d.hpp:59
std::optional< ComponentBatch > axis_length
Visual length of the 3 axes.
Definition transform_axes3d.hpp:64
TransformAxes3D with_many_show_frame(const Collection< rerun::components::ShowLabels > &_show_frame) &&
This method makes it possible to pack multiple show_frame in a single component batch.
Definition transform_axes3d.hpp:138
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
TransformAxes3D with_show_frame(const rerun::components::ShowLabels &_show_frame) &&
Whether to show a text label with the corresponding frame.
Definition transform_axes3d.hpp:128
TransformAxes3D with_axis_length(const rerun::components::AxisLength &_axis_length) &&
Visual length of the 3 axes.
Definition transform_axes3d.hpp:109
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
static constexpr auto Descriptor_show_frame
ComponentDescriptor for the show_frame field.
Definition transform_axes3d.hpp:79
static TransformAxes3D clear_fields()
Clear all the fields of a TransformAxes3D.
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition transform_axes3d.hpp:71
static constexpr auto Descriptor_axis_length
ComponentDescriptor for the axis_length field.
Definition transform_axes3d.hpp:74
std::optional< ComponentBatch > show_frame
Whether to show a text label with the corresponding frame.
Definition transform_axes3d.hpp:67
static TransformAxes3D update_fields()
Update only some specific fields of a TransformAxes3D.
Definition transform_axes3d.hpp:98
TransformAxes3D 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 transform_axes3d.hpp:119
Component: The length of an axis in local units of the space.
Definition axis_length.hpp:14
Component: Whether the entity's components::Text label is shown.
Definition show_labels.hpp:18