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