Rerun C++ SDK
Loading...
Searching...
No Matches
cylinders3d.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/cylinders3d.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../component_batch.hpp"
8#include "../component_column.hpp"
9#include "../components/class_id.hpp"
10#include "../components/color.hpp"
11#include "../components/fill_mode.hpp"
12#include "../components/length.hpp"
13#include "../components/pose_rotation_axis_angle.hpp"
14#include "../components/pose_rotation_quat.hpp"
15#include "../components/pose_translation3d.hpp"
16#include "../components/radius.hpp"
17#include "../components/show_labels.hpp"
18#include "../components/text.hpp"
19#include "../indicator_component.hpp"
20#include "../result.hpp"
21
22#include <cstdint>
23#include <optional>
24#include <utility>
25#include <vector>
26
27namespace rerun::archetypes {
28 /// **Archetype**: 3D cylinders with flat caps.
29 ///
30 /// This archetype is for cylinder primitives defined by their axial length and radius.
31 /// For points whose radii are for visualization purposes, use `archetypes::Points3D` instead.
32 ///
33 /// Orienting and placing cylinders forms a separate transform that is applied prior to `archetypes::InstancePoses3D` and `archetypes::Transform3D`.
34 ///
35 /// ## Example
36 ///
37 /// ### Batch of cylinders
38 /// ![image](https://static.rerun.io/cylinders3d_batch/ef642dede2bef23704eaff0f22aa48284d482b23/full.png)
39 ///
40 /// ```cpp
41 /// #include <rerun.hpp>
42 ///
43 /// int main() {
44 /// const auto rec = rerun::RecordingStream("rerun_example_cylinders3d_batch");
45 /// rec.spawn().exit_on_failure();
46 ///
47 /// rec.log(
48 /// "cylinders",
49 /// rerun::Cylinders3D::from_lengths_and_radii(
50 /// {0.0f, 2.0f, 4.0f, 6.0f, 8.0f},
51 /// {1.0f, 0.5f, 0.5f, 0.5f, 1.0f}
52 /// )
53 /// .with_colors({
54 /// rerun::Rgba32(255, 0, 0),
55 /// rerun::Rgba32(188, 188, 0),
56 /// rerun::Rgba32(0, 255, 0),
57 /// rerun::Rgba32(0, 188, 188),
58 /// rerun::Rgba32(0, 0, 255),
59 /// })
60 /// .with_centers({
61 /// {0.0f, 0.0f, 0.0f},
62 /// {2.0f, 0.0f, 0.0f},
63 /// {4.0f, 0.0f, 0.0f},
64 /// {6.0f, 0.0f, 0.0f},
65 /// {8.0f, 0.0f, 0.0f},
66 /// })
67 /// .with_rotation_axis_angles({
68 /// rerun::RotationAxisAngle({1.0f, 0.0f, 0.0f}, rerun::Angle::degrees(0.0)),
69 /// rerun::RotationAxisAngle({1.0f, 0.0f, 0.0f}, rerun::Angle::degrees(-22.5)),
70 /// rerun::RotationAxisAngle({1.0f, 0.0f, 0.0f}, rerun::Angle::degrees(-45.0)),
71 /// rerun::RotationAxisAngle({1.0f, 0.0f, 0.0f}, rerun::Angle::degrees(-67.5)),
72 /// rerun::RotationAxisAngle({1.0f, 0.0f, 0.0f}, rerun::Angle::degrees(-90.0)),
73 /// })
74 /// );
75 /// }
76 /// ```
77 struct Cylinders3D {
78 /// The total axial length of the cylinder, measured as the straight-line distance between the centers of its two endcaps.
79 std::optional<ComponentBatch> lengths;
80
81 /// Radii of the cylinders.
82 std::optional<ComponentBatch> radii;
83
84 /// Optional centers of the cylinders.
85 ///
86 /// If not specified, each cylinder will be centered at (0, 0, 0).
87 std::optional<ComponentBatch> centers;
88
89 /// Rotations via axis + angle.
90 ///
91 /// If no rotation is specified, the cylinders align with the +Z axis of the local coordinate system.
92 std::optional<ComponentBatch> rotation_axis_angles;
93
94 /// Rotations via quaternion.
95 ///
96 /// If no rotation is specified, the cylinders align with the +Z axis of the local coordinate system.
97 std::optional<ComponentBatch> quaternions;
98
99 /// Optional colors for the cylinders.
100 std::optional<ComponentBatch> colors;
101
102 /// Optional radii for the lines used when the cylinder is rendered as a wireframe.
103 std::optional<ComponentBatch> line_radii;
104
105 /// Optionally choose whether the cylinders are drawn with lines or solid.
106 std::optional<ComponentBatch> fill_mode;
107
108 /// Optional text labels for the cylinders, which will be located at their centers.
109 std::optional<ComponentBatch> labels;
110
111 /// Whether the text labels should be shown.
112 ///
113 /// If not set, labels will automatically appear when there is exactly one label for this entity
114 /// or the number of instances on this entity is under a certain threshold.
115 std::optional<ComponentBatch> show_labels;
116
117 /// Optional class ID for the ellipsoids.
118 ///
119 /// The class ID provides colors and labels if not specified explicitly.
120 std::optional<ComponentBatch> class_ids;
121
122 public:
123 static constexpr const char IndicatorComponentName[] =
124 "rerun.components.Cylinders3DIndicator";
125
126 /// Indicator component, used to identify the archetype when converting to a list of components.
128 /// The name of the archetype as used in `ComponentDescriptor`s.
129 static constexpr const char ArchetypeName[] = "rerun.archetypes.Cylinders3D";
130
131 /// `ComponentDescriptor` for the `lengths` field.
134 );
135 /// `ComponentDescriptor` for the `radii` field.
136 static constexpr auto Descriptor_radii = ComponentDescriptor(
138 );
139 /// `ComponentDescriptor` for the `centers` field.
141 ArchetypeName, "centers",
143 );
144 /// `ComponentDescriptor` for the `rotation_axis_angles` field.
146 ArchetypeName, "rotation_axis_angles",
148 );
149 /// `ComponentDescriptor` for the `quaternions` field.
151 ArchetypeName, "quaternions",
153 );
154 /// `ComponentDescriptor` for the `colors` field.
155 static constexpr auto Descriptor_colors = ComponentDescriptor(
157 );
158 /// `ComponentDescriptor` for the `line_radii` field.
160 ArchetypeName, "line_radii",
162 );
163 /// `ComponentDescriptor` for the `fill_mode` field.
165 ArchetypeName, "fill_mode",
167 );
168 /// `ComponentDescriptor` for the `labels` field.
169 static constexpr auto Descriptor_labels = ComponentDescriptor(
171 );
172 /// `ComponentDescriptor` for the `show_labels` field.
174 ArchetypeName, "show_labels",
176 );
177 /// `ComponentDescriptor` for the `class_ids` field.
179 ArchetypeName, "class_ids",
181 );
182
183 public: // START of extensions from cylinders3d_ext.cpp:
184 /// Creates a new `Cylinders3D` with the given axis-aligned lengths and radii.
185 ///
186 /// For multiple cylinders, you should generally follow this with
187 /// `Cylinders3D::with_centers()` and one of the rotation methods, in order to move them
188 /// apart from each other.
192 ) {
194 }
195
196 // END of extensions from cylinders3d_ext.cpp, start of generated code:
197
198 public:
199 Cylinders3D() = default;
200 Cylinders3D(Cylinders3D&& other) = default;
201 Cylinders3D(const Cylinders3D& other) = default;
202 Cylinders3D& operator=(const Cylinders3D& other) = default;
203 Cylinders3D& operator=(Cylinders3D&& other) = default;
204
205 /// Update only some specific fields of a `Cylinders3D`.
207 return Cylinders3D();
208 }
209
210 /// Clear all the fields of a `Cylinders3D`.
212
213 /// The total axial length of the cylinder, measured as the straight-line distance between the centers of its two endcaps.
215 lengths = ComponentBatch::from_loggable(_lengths, Descriptor_lengths).value_or_throw();
216 return std::move(*this);
217 }
218
219 /// Radii of the cylinders.
221 radii = ComponentBatch::from_loggable(_radii, Descriptor_radii).value_or_throw();
222 return std::move(*this);
223 }
224
225 /// Optional centers of the cylinders.
226 ///
227 /// If not specified, each cylinder will be centered at (0, 0, 0).
229 ) && {
230 centers = ComponentBatch::from_loggable(_centers, Descriptor_centers).value_or_throw();
231 return std::move(*this);
232 }
233
234 /// Rotations via axis + angle.
235 ///
236 /// If no rotation is specified, the cylinders align with the +Z axis of the local coordinate system.
239 ) && {
241 _rotation_axis_angles,
243 )
244 .value_or_throw();
245 return std::move(*this);
246 }
247
248 /// Rotations via quaternion.
249 ///
250 /// If no rotation is specified, the cylinders align with the +Z axis of the local coordinate system.
253 ) && {
255 .value_or_throw();
256 return std::move(*this);
257 }
258
259 /// Optional colors for the cylinders.
261 colors = ComponentBatch::from_loggable(_colors, Descriptor_colors).value_or_throw();
262 return std::move(*this);
263 }
264
265 /// Optional radii for the lines used when the cylinder is rendered as a wireframe.
267 line_radii =
268 ComponentBatch::from_loggable(_line_radii, Descriptor_line_radii).value_or_throw();
269 return std::move(*this);
270 }
271
272 /// Optionally choose whether the cylinders are drawn with lines or solid.
274 fill_mode =
275 ComponentBatch::from_loggable(_fill_mode, Descriptor_fill_mode).value_or_throw();
276 return std::move(*this);
277 }
278
279 /// This method makes it possible to pack multiple `fill_mode` in a single component batch.
280 ///
281 /// This only makes sense when used in conjunction with `columns`. `with_fill_mode` should
282 /// be used when logging a single row's worth of data.
284 ) && {
285 fill_mode =
286 ComponentBatch::from_loggable(_fill_mode, Descriptor_fill_mode).value_or_throw();
287 return std::move(*this);
288 }
289
290 /// Optional text labels for the cylinders, which will be located at their centers.
292 labels = ComponentBatch::from_loggable(_labels, Descriptor_labels).value_or_throw();
293 return std::move(*this);
294 }
295
296 /// Whether the text labels should be shown.
297 ///
298 /// If not set, labels will automatically appear when there is exactly one label for this entity
299 /// or the number of instances on this entity is under a certain threshold.
302 .value_or_throw();
303 return std::move(*this);
304 }
305
306 /// This method makes it possible to pack multiple `show_labels` in a single component batch.
307 ///
308 /// This only makes sense when used in conjunction with `columns`. `with_show_labels` should
309 /// be used when logging a single row's worth of data.
312 ) && {
314 .value_or_throw();
315 return std::move(*this);
316 }
317
318 /// Optional class ID for the ellipsoids.
319 ///
320 /// The class ID provides colors and labels if not specified explicitly.
322 class_ids =
323 ComponentBatch::from_loggable(_class_ids, Descriptor_class_ids).value_or_throw();
324 return std::move(*this);
325 }
326
327 /// Partitions the component data into multiple sub-batches.
328 ///
329 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
330 /// instead, via `ComponentBatch::partitioned`.
331 ///
332 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
333 ///
334 /// The specified `lengths` must sum to the total length of the component batch.
336
337 /// Partitions the component data into unit-length sub-batches.
338 ///
339 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
340 /// where `n` is automatically guessed.
342 };
343
344} // namespace rerun::archetypes
345
346namespace rerun {
347 /// \private
348 template <typename T>
349 struct AsComponents;
350
351 /// \private
352 template <>
353 struct AsComponents<archetypes::Cylinders3D> {
354 /// Serialize all set component batches.
355 static Result<Collection<ComponentBatch>> as_batches(
356 const archetypes::Cylinders3D& archetype
357 );
358 };
359} // 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
FillMode
Component: How a geometric shape is drawn and colored.
Definition fill_mode.hpp:25
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:14
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Archetype: 3D cylinders with flat caps.
Definition cylinders3d.hpp:77
std::optional< ComponentBatch > show_labels
Whether the text labels should be shown.
Definition cylinders3d.hpp:115
static constexpr auto Descriptor_labels
ComponentDescriptor for the labels field.
Definition cylinders3d.hpp:169
std::optional< ComponentBatch > class_ids
Optional class ID for the ellipsoids.
Definition cylinders3d.hpp:120
Cylinders3D with_line_radii(const Collection< rerun::components::Radius > &_line_radii) &&
Optional radii for the lines used when the cylinder is rendered as a wireframe.
Definition cylinders3d.hpp:266
static constexpr auto Descriptor_quaternions
ComponentDescriptor for the quaternions field.
Definition cylinders3d.hpp:150
Cylinders3D with_quaternions(const Collection< rerun::components::PoseRotationQuat > &_quaternions) &&
Rotations via quaternion.
Definition cylinders3d.hpp:251
std::optional< ComponentBatch > lengths
The total axial length of the cylinder, measured as the straight-line distance between the centers of...
Definition cylinders3d.hpp:79
static constexpr auto Descriptor_line_radii
ComponentDescriptor for the line_radii field.
Definition cylinders3d.hpp:159
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition cylinders3d.hpp:129
std::optional< ComponentBatch > line_radii
Optional radii for the lines used when the cylinder is rendered as a wireframe.
Definition cylinders3d.hpp:103
static constexpr auto Descriptor_class_ids
ComponentDescriptor for the class_ids field.
Definition cylinders3d.hpp:178
static Cylinders3D from_lengths_and_radii(const Collection< rerun::components::Length > &lengths, const Collection< rerun::components::Radius > &radii)
Creates a new Cylinders3D with the given axis-aligned lengths and radii.
Definition cylinders3d.hpp:189
std::optional< ComponentBatch > centers
Optional centers of the cylinders.
Definition cylinders3d.hpp:87
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
static constexpr auto Descriptor_radii
ComponentDescriptor for the radii field.
Definition cylinders3d.hpp:136
std::optional< ComponentBatch > quaternions
Rotations via quaternion.
Definition cylinders3d.hpp:97
Cylinders3D with_lengths(const Collection< rerun::components::Length > &_lengths) &&
The total axial length of the cylinder, measured as the straight-line distance between the centers of...
Definition cylinders3d.hpp:214
static Cylinders3D update_fields()
Update only some specific fields of a Cylinders3D.
Definition cylinders3d.hpp:206
std::optional< ComponentBatch > radii
Radii of the cylinders.
Definition cylinders3d.hpp:82
Cylinders3D with_show_labels(const rerun::components::ShowLabels &_show_labels) &&
Whether the text labels should be shown.
Definition cylinders3d.hpp:300
Cylinders3D with_centers(const Collection< rerun::components::PoseTranslation3D > &_centers) &&
Optional centers of the cylinders.
Definition cylinders3d.hpp:228
static Cylinders3D clear_fields()
Clear all the fields of a Cylinders3D.
Cylinders3D with_many_show_labels(const Collection< rerun::components::ShowLabels > &_show_labels) &&
This method makes it possible to pack multiple show_labels in a single component batch.
Definition cylinders3d.hpp:310
std::optional< ComponentBatch > colors
Optional colors for the cylinders.
Definition cylinders3d.hpp:100
Cylinders3D with_many_fill_mode(const Collection< rerun::components::FillMode > &_fill_mode) &&
This method makes it possible to pack multiple fill_mode in a single component batch.
Definition cylinders3d.hpp:283
Cylinders3D with_fill_mode(const rerun::components::FillMode &_fill_mode) &&
Optionally choose whether the cylinders are drawn with lines or solid.
Definition cylinders3d.hpp:273
std::optional< ComponentBatch > labels
Optional text labels for the cylinders, which will be located at their centers.
Definition cylinders3d.hpp:109
std::optional< ComponentBatch > rotation_axis_angles
Rotations via axis + angle.
Definition cylinders3d.hpp:92
static constexpr auto Descriptor_fill_mode
ComponentDescriptor for the fill_mode field.
Definition cylinders3d.hpp:164
static constexpr auto Descriptor_show_labels
ComponentDescriptor for the show_labels field.
Definition cylinders3d.hpp:173
std::optional< ComponentBatch > fill_mode
Optionally choose whether the cylinders are drawn with lines or solid.
Definition cylinders3d.hpp:106
static constexpr auto Descriptor_rotation_axis_angles
ComponentDescriptor for the rotation_axis_angles field.
Definition cylinders3d.hpp:145
static constexpr auto Descriptor_colors
ComponentDescriptor for the colors field.
Definition cylinders3d.hpp:155
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
static constexpr auto Descriptor_centers
ComponentDescriptor for the centers field.
Definition cylinders3d.hpp:140
Cylinders3D with_colors(const Collection< rerun::components::Color > &_colors) &&
Optional colors for the cylinders.
Definition cylinders3d.hpp:260
Cylinders3D with_radii(const Collection< rerun::components::Radius > &_radii) &&
Radii of the cylinders.
Definition cylinders3d.hpp:220
Cylinders3D with_class_ids(const Collection< rerun::components::ClassId > &_class_ids) &&
Optional class ID for the ellipsoids.
Definition cylinders3d.hpp:321
Cylinders3D with_labels(const Collection< rerun::components::Text > &_labels) &&
Optional text labels for the cylinders, which will be located at their centers.
Definition cylinders3d.hpp:291
Cylinders3D with_rotation_axis_angles(const Collection< rerun::components::PoseRotationAxisAngle > &_rotation_axis_angles) &&
Rotations via axis + angle.
Definition cylinders3d.hpp:237
static constexpr auto Descriptor_lengths
ComponentDescriptor for the lengths field.
Definition cylinders3d.hpp:132
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32
Component: Whether the entity's components::Text label is shown.
Definition show_labels.hpp:19