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 "../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() {
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({1.0f, 0.0f, 0.0f}, rerun::Angle::degrees(0.0)),
68 /// rerun::RotationAxisAngle({1.0f, 0.0f, 0.0f}, rerun::Angle::degrees(-22.5)),
69 /// rerun::RotationAxisAngle({1.0f, 0.0f, 0.0f}, rerun::Angle::degrees(-45.0)),
70 /// rerun::RotationAxisAngle({1.0f, 0.0f, 0.0f}, rerun::Angle::degrees(-67.5)),
71 /// rerun::RotationAxisAngle({1.0f, 0.0f, 0.0f}, rerun::Angle::degrees(-90.0)),
72 /// })
73 /// );
74 /// }
75 /// ```
76 struct Cylinders3D {
77 /// The total axial length of the cylinder, measured as the straight-line distance between the centers of its two endcaps.
78 std::optional<ComponentBatch> lengths;
79
80 /// Radii of the cylinders.
81 std::optional<ComponentBatch> radii;
82
83 /// Optional centers of the cylinders.
84 ///
85 /// If not specified, each cylinder will be centered at (0, 0, 0).
86 std::optional<ComponentBatch> centers;
87
88 /// Rotations via axis + angle.
89 ///
90 /// If no rotation is specified, the cylinders align with the +Z axis of the local coordinate system.
91 std::optional<ComponentBatch> rotation_axis_angles;
92
93 /// Rotations via quaternion.
94 ///
95 /// If no rotation is specified, the cylinders align with the +Z axis of the local coordinate system.
96 std::optional<ComponentBatch> quaternions;
97
98 /// Optional colors for the cylinders.
99 ///
100 /// Alpha channel is used for transparency for solid fill-mode.
101 std::optional<ComponentBatch> colors;
102
103 /// Optional radii for the lines used when the cylinder is rendered as a wireframe.
104 std::optional<ComponentBatch> line_radii;
105
106 /// Optionally choose whether the cylinders are drawn with lines or solid.
107 std::optional<ComponentBatch> fill_mode;
108
109 /// Optional text labels for the cylinders, which will be located at their centers.
110 std::optional<ComponentBatch> labels;
111
112 /// Whether the text labels should be shown.
113 ///
114 /// If not set, labels will automatically appear when there is exactly one label for this entity
115 /// or the number of instances on this entity is under a certain threshold.
116 std::optional<ComponentBatch> show_labels;
117
118 /// Optional class ID for the ellipsoids.
119 ///
120 /// The class ID provides colors and labels if not specified explicitly.
121 std::optional<ComponentBatch> class_ids;
122
123 public:
124 /// The name of the archetype as used in `ComponentDescriptor`s.
125 static constexpr const char ArchetypeName[] = "rerun.archetypes.Cylinders3D";
126
127 /// `ComponentDescriptor` for the `lengths` field.
130 );
131 /// `ComponentDescriptor` for the `radii` field.
132 static constexpr auto Descriptor_radii = ComponentDescriptor(
134 );
135 /// `ComponentDescriptor` for the `centers` field.
137 ArchetypeName, "Cylinders3D:centers",
139 );
140 /// `ComponentDescriptor` for the `rotation_axis_angles` field.
142 ArchetypeName, "Cylinders3D:rotation_axis_angles",
144 );
145 /// `ComponentDescriptor` for the `quaternions` field.
147 ArchetypeName, "Cylinders3D:quaternions",
149 );
150 /// `ComponentDescriptor` for the `colors` field.
151 static constexpr auto Descriptor_colors = ComponentDescriptor(
153 );
154 /// `ComponentDescriptor` for the `line_radii` field.
156 ArchetypeName, "Cylinders3D:line_radii",
158 );
159 /// `ComponentDescriptor` for the `fill_mode` field.
161 ArchetypeName, "Cylinders3D:fill_mode",
163 );
164 /// `ComponentDescriptor` for the `labels` field.
165 static constexpr auto Descriptor_labels = ComponentDescriptor(
167 );
168 /// `ComponentDescriptor` for the `show_labels` field.
170 ArchetypeName, "Cylinders3D:show_labels",
172 );
173 /// `ComponentDescriptor` for the `class_ids` field.
175 ArchetypeName, "Cylinders3D:class_ids",
177 );
178
179 public: // START of extensions from cylinders3d_ext.cpp:
180 /// Creates a new `Cylinders3D` with the given axis-aligned lengths and radii.
181 ///
182 /// For multiple cylinders, you should generally follow this with
183 /// `Cylinders3D::with_centers()` and one of the rotation methods, in order to move them
184 /// apart from each other.
188 ) {
190 }
191
192 // END of extensions from cylinders3d_ext.cpp, start of generated code:
193
194 public:
195 Cylinders3D() = default;
196 Cylinders3D(Cylinders3D&& other) = default;
197 Cylinders3D(const Cylinders3D& other) = default;
198 Cylinders3D& operator=(const Cylinders3D& other) = default;
199 Cylinders3D& operator=(Cylinders3D&& other) = default;
200
201 /// Update only some specific fields of a `Cylinders3D`.
203 return Cylinders3D();
204 }
205
206 /// Clear all the fields of a `Cylinders3D`.
208
209 /// The total axial length of the cylinder, measured as the straight-line distance between the centers of its two endcaps.
211 lengths = ComponentBatch::from_loggable(_lengths, Descriptor_lengths).value_or_throw();
212 return std::move(*this);
213 }
214
215 /// Radii of the cylinders.
217 radii = ComponentBatch::from_loggable(_radii, Descriptor_radii).value_or_throw();
218 return std::move(*this);
219 }
220
221 /// Optional centers of the cylinders.
222 ///
223 /// If not specified, each cylinder will be centered at (0, 0, 0).
225 ) && {
226 centers = ComponentBatch::from_loggable(_centers, Descriptor_centers).value_or_throw();
227 return std::move(*this);
228 }
229
230 /// Rotations via axis + angle.
231 ///
232 /// If no rotation is specified, the cylinders align with the +Z axis of the local coordinate system.
235 ) && {
237 _rotation_axis_angles,
239 )
240 .value_or_throw();
241 return std::move(*this);
242 }
243
244 /// Rotations via quaternion.
245 ///
246 /// If no rotation is specified, the cylinders align with the +Z axis of the local coordinate system.
249 ) && {
251 .value_or_throw();
252 return std::move(*this);
253 }
254
255 /// Optional colors for the cylinders.
256 ///
257 /// Alpha channel is used for transparency for solid fill-mode.
259 colors = ComponentBatch::from_loggable(_colors, Descriptor_colors).value_or_throw();
260 return std::move(*this);
261 }
262
263 /// Optional radii for the lines used when the cylinder is rendered as a wireframe.
265 line_radii =
266 ComponentBatch::from_loggable(_line_radii, Descriptor_line_radii).value_or_throw();
267 return std::move(*this);
268 }
269
270 /// Optionally choose whether the cylinders are drawn with lines or solid.
272 fill_mode =
273 ComponentBatch::from_loggable(_fill_mode, Descriptor_fill_mode).value_or_throw();
274 return std::move(*this);
275 }
276
277 /// This method makes it possible to pack multiple `fill_mode` in a single component batch.
278 ///
279 /// This only makes sense when used in conjunction with `columns`. `with_fill_mode` should
280 /// be used when logging a single row's worth of data.
282 ) && {
283 fill_mode =
284 ComponentBatch::from_loggable(_fill_mode, Descriptor_fill_mode).value_or_throw();
285 return std::move(*this);
286 }
287
288 /// Optional text labels for the cylinders, which will be located at their centers.
290 labels = ComponentBatch::from_loggable(_labels, Descriptor_labels).value_or_throw();
291 return std::move(*this);
292 }
293
294 /// Whether the text labels should be shown.
295 ///
296 /// If not set, labels will automatically appear when there is exactly one label for this entity
297 /// or the number of instances on this entity is under a certain threshold.
300 .value_or_throw();
301 return std::move(*this);
302 }
303
304 /// This method makes it possible to pack multiple `show_labels` in a single component batch.
305 ///
306 /// This only makes sense when used in conjunction with `columns`. `with_show_labels` should
307 /// be used when logging a single row's worth of data.
310 ) && {
312 .value_or_throw();
313 return std::move(*this);
314 }
315
316 /// Optional class ID for the ellipsoids.
317 ///
318 /// The class ID provides colors and labels if not specified explicitly.
320 class_ids =
321 ComponentBatch::from_loggable(_class_ids, Descriptor_class_ids).value_or_throw();
322 return std::move(*this);
323 }
324
325 /// Partitions the component data into multiple sub-batches.
326 ///
327 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
328 /// instead, via `ComponentBatch::partitioned`.
329 ///
330 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
331 ///
332 /// The specified `lengths` must sum to the total length of the component batch.
334
335 /// Partitions the component data into unit-length sub-batches.
336 ///
337 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
338 /// where `n` is automatically guessed.
340 };
341
342} // namespace rerun::archetypes
343
344namespace rerun {
345 /// \private
346 template <typename T>
347 struct AsComponents;
348
349 /// \private
350 template <>
351 struct AsComponents<archetypes::Cylinders3D> {
352 /// Serialize all set component batches.
353 static Result<Collection<ComponentBatch>> as_batches(
354 const archetypes::Cylinders3D& archetype
355 );
356 };
357} // 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: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:76
std::optional< ComponentBatch > show_labels
Whether the text labels should be shown.
Definition cylinders3d.hpp:116
static constexpr auto Descriptor_labels
ComponentDescriptor for the labels field.
Definition cylinders3d.hpp:165
std::optional< ComponentBatch > class_ids
Optional class ID for the ellipsoids.
Definition cylinders3d.hpp:121
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:264
static constexpr auto Descriptor_quaternions
ComponentDescriptor for the quaternions field.
Definition cylinders3d.hpp:146
Cylinders3D with_quaternions(const Collection< rerun::components::PoseRotationQuat > &_quaternions) &&
Rotations via quaternion.
Definition cylinders3d.hpp:247
std::optional< ComponentBatch > lengths
The total axial length of the cylinder, measured as the straight-line distance between the centers of...
Definition cylinders3d.hpp:78
static constexpr auto Descriptor_line_radii
ComponentDescriptor for the line_radii field.
Definition cylinders3d.hpp:155
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition cylinders3d.hpp:125
std::optional< ComponentBatch > line_radii
Optional radii for the lines used when the cylinder is rendered as a wireframe.
Definition cylinders3d.hpp:104
static constexpr auto Descriptor_class_ids
ComponentDescriptor for the class_ids field.
Definition cylinders3d.hpp:174
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:185
std::optional< ComponentBatch > centers
Optional centers of the cylinders.
Definition cylinders3d.hpp:86
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:132
std::optional< ComponentBatch > quaternions
Rotations via quaternion.
Definition cylinders3d.hpp:96
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:210
static Cylinders3D update_fields()
Update only some specific fields of a Cylinders3D.
Definition cylinders3d.hpp:202
std::optional< ComponentBatch > radii
Radii of the cylinders.
Definition cylinders3d.hpp:81
Cylinders3D with_show_labels(const rerun::components::ShowLabels &_show_labels) &&
Whether the text labels should be shown.
Definition cylinders3d.hpp:298
Cylinders3D with_centers(const Collection< rerun::components::PoseTranslation3D > &_centers) &&
Optional centers of the cylinders.
Definition cylinders3d.hpp:224
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:308
std::optional< ComponentBatch > colors
Optional colors for the cylinders.
Definition cylinders3d.hpp:101
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:281
Cylinders3D with_fill_mode(const rerun::components::FillMode &_fill_mode) &&
Optionally choose whether the cylinders are drawn with lines or solid.
Definition cylinders3d.hpp:271
std::optional< ComponentBatch > labels
Optional text labels for the cylinders, which will be located at their centers.
Definition cylinders3d.hpp:110
std::optional< ComponentBatch > rotation_axis_angles
Rotations via axis + angle.
Definition cylinders3d.hpp:91
static constexpr auto Descriptor_fill_mode
ComponentDescriptor for the fill_mode field.
Definition cylinders3d.hpp:160
static constexpr auto Descriptor_show_labels
ComponentDescriptor for the show_labels field.
Definition cylinders3d.hpp:169
std::optional< ComponentBatch > fill_mode
Optionally choose whether the cylinders are drawn with lines or solid.
Definition cylinders3d.hpp:107
static constexpr auto Descriptor_rotation_axis_angles
ComponentDescriptor for the rotation_axis_angles field.
Definition cylinders3d.hpp:141
static constexpr auto Descriptor_colors
ComponentDescriptor for the colors field.
Definition cylinders3d.hpp:151
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:136
Cylinders3D with_colors(const Collection< rerun::components::Color > &_colors) &&
Optional colors for the cylinders.
Definition cylinders3d.hpp:258
Cylinders3D with_radii(const Collection< rerun::components::Radius > &_radii) &&
Radii of the cylinders.
Definition cylinders3d.hpp:216
Cylinders3D with_class_ids(const Collection< rerun::components::ClassId > &_class_ids) &&
Optional class ID for the ellipsoids.
Definition cylinders3d.hpp:319
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:289
Cylinders3D with_rotation_axis_angles(const Collection< rerun::components::PoseRotationAxisAngle > &_rotation_axis_angles) &&
Rotations via axis + angle.
Definition cylinders3d.hpp:233
static constexpr auto Descriptor_lengths
ComponentDescriptor for the lengths field.
Definition cylinders3d.hpp:128
Component: Whether the entity's components::Text label is shown.
Definition show_labels.hpp:18