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() {
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(rerun::RotationAxisAngle(
43 /// {1.0f, 1.0f, 1.0f},
44 /// rerun::Angle::degrees(static_cast<float>(deg))
45 /// )),
46 /// rerun::TransformAxes3D(0.5)
47 /// );
48 ///
49 /// rec.log(
50 /// "base/rotated/translated",
51 /// rerun::Transform3D().with_translation({2.0f, 0.0f, 0.0f}),
52 /// rerun::TransformAxes3D(0.5)
53 /// );
54 /// }
55 /// }
56 /// ```
58 /// Visual length of the 3 axes.
59 ///
60 /// The length is interpreted in the local coordinate system of the transform.
61 /// If the transform is scaled, the axes will be scaled accordingly.
62 std::optional<ComponentBatch> axis_length;
63
64 /// Whether to show a text label with the corresponding frame.
65 std::optional<ComponentBatch> show_frame;
66
67 public:
68 /// The name of the archetype as used in `ComponentDescriptor`s.
69 static constexpr const char ArchetypeName[] = "rerun.archetypes.TransformAxes3D";
70
71 /// `ComponentDescriptor` for the `axis_length` field.
73 ArchetypeName, "TransformAxes3D:axis_length",
75 );
76 /// `ComponentDescriptor` for the `show_frame` field.
78 ArchetypeName, "TransformAxes3D:show_frame",
80 );
81
82 public:
83 TransformAxes3D() = default;
84 TransformAxes3D(TransformAxes3D&& other) = default;
85 TransformAxes3D(const TransformAxes3D& other) = default;
86 TransformAxes3D& operator=(const TransformAxes3D& other) = default;
87 TransformAxes3D& operator=(TransformAxes3D&& other) = default;
88
91 ComponentBatch::from_loggable(std::move(_axis_length), Descriptor_axis_length)
92 .value_or_throw()
93 ) {}
94
95 /// Update only some specific fields of a `TransformAxes3D`.
97 return TransformAxes3D();
98 }
99
100 /// Clear all the fields of a `TransformAxes3D`.
102
103 /// Visual length of the 3 axes.
104 ///
105 /// The length is interpreted in the local coordinate system of the transform.
106 /// If the transform is scaled, the axes will be scaled accordingly.
109 .value_or_throw();
110 return std::move(*this);
111 }
112
113 /// This method makes it possible to pack multiple `axis_length` in a single component batch.
114 ///
115 /// This only makes sense when used in conjunction with `columns`. `with_axis_length` should
116 /// be used when logging a single row's worth of data.
119 ) && {
121 .value_or_throw();
122 return std::move(*this);
123 }
124
125 /// Whether to show a text label with the corresponding frame.
127 show_frame =
128 ComponentBatch::from_loggable(_show_frame, Descriptor_show_frame).value_or_throw();
129 return std::move(*this);
130 }
131
132 /// This method makes it possible to pack multiple `show_frame` in a single component batch.
133 ///
134 /// This only makes sense when used in conjunction with `columns`. `with_show_frame` should
135 /// be used when logging a single row's worth of data.
138 ) && {
139 show_frame =
140 ComponentBatch::from_loggable(_show_frame, Descriptor_show_frame).value_or_throw();
141 return std::move(*this);
142 }
143
144 /// Partitions the component data into multiple sub-batches.
145 ///
146 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
147 /// instead, via `ComponentBatch::partitioned`.
148 ///
149 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
150 ///
151 /// The specified `lengths` must sum to the total length of the component batch.
153
154 /// Partitions the component data into unit-length sub-batches.
155 ///
156 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
157 /// where `n` is automatically guessed.
159 };
160
161} // namespace rerun::archetypes
162
163namespace rerun {
164 /// \private
165 template <typename T>
166 struct AsComponents;
167
168 /// \private
169 template <>
170 struct AsComponents<archetypes::TransformAxes3D> {
171 /// Serialize all set component batches.
172 static Result<Collection<ComponentBatch>> as_batches(
173 const archetypes::TransformAxes3D& archetype
174 );
175 };
176} // 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
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:57
std::optional< ComponentBatch > axis_length
Visual length of the 3 axes.
Definition transform_axes3d.hpp:62
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:136
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:126
TransformAxes3D with_axis_length(const rerun::components::AxisLength &_axis_length) &&
Visual length of the 3 axes.
Definition transform_axes3d.hpp:107
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:77
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:69
static constexpr auto Descriptor_axis_length
ComponentDescriptor for the axis_length field.
Definition transform_axes3d.hpp:72
std::optional< ComponentBatch > show_frame
Whether to show a text label with the corresponding frame.
Definition transform_axes3d.hpp:65
static TransformAxes3D update_fields()
Update only some specific fields of a TransformAxes3D.
Definition transform_axes3d.hpp:96
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:117
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