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