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