Rerun C++ SDK
Loading...
Searching...
No Matches
capsules3d.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/capsules3d.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../component_batch.hpp"
9#include "../components/class_id.hpp"
10#include "../components/color.hpp"
11#include "../components/length.hpp"
12#include "../components/pose_rotation_axis_angle.hpp"
13#include "../components/pose_rotation_quat.hpp"
14#include "../components/pose_translation3d.hpp"
15#include "../components/radius.hpp"
16#include "../components/show_labels.hpp"
17#include "../components/text.hpp"
18#include "../indicator_component.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 capsules; cylinders with hemispherical caps.
28 ///
29 /// Capsules are defined by two endpoints (the centers of their end cap spheres), which are located
30 /// at (0, 0, 0) and (0, 0, length), that is, extending along the positive direction of the Z axis.
31 /// Capsules in other orientations may be produced by applying a rotation to the entity or
32 /// instances.
33 ///
34 /// ## Example
35 ///
36 /// ### Batch of capsules
37 /// ![image](https://static.rerun.io/capsule3d_batch/6e6a4acafcf528359372147d7247f85d84434101/full.png)
38 ///
39 /// ```cpp
40 /// #include <rerun.hpp>
41 ///
42 /// int main() {
43 /// const auto rec = rerun::RecordingStream("rerun_example_capsule3d_batch");
44 /// rec.spawn().exit_on_failure();
45 ///
46 /// rec.log(
47 /// "capsules",
48 /// rerun::Capsules3D::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_translations({
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 /// 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 Capsules3D {
77 /// Lengths of the capsules, defined as the distance between the centers of the endcaps.
79
80 /// Radii of the capsules.
82
83 /// Optional translations of the capsules.
84 ///
85 /// If not specified, one end of each capsule will be at (0, 0, 0).
86 /// Note that this uses a `components::PoseTranslation3D` which is also used by `archetypes::InstancePoses3D`.
87 std::optional<Collection<rerun::components::PoseTranslation3D>> translations;
88
89 /// Rotations via axis + angle.
90 ///
91 /// If no rotation is specified, the capsules align with the +Z axis of the local coordinate system.
92 /// Note that this uses a `components::PoseRotationAxisAngle` which is also used by `archetypes::InstancePoses3D`.
93 std::optional<Collection<rerun::components::PoseRotationAxisAngle>> rotation_axis_angles;
94
95 /// Rotations via quaternion.
96 ///
97 /// If no rotation is specified, the capsules align with the +Z axis of the local coordinate system.
98 /// Note that this uses a `components::PoseRotationQuat` which is also used by `archetypes::InstancePoses3D`.
99 std::optional<Collection<rerun::components::PoseRotationQuat>> quaternions;
100
101 /// Optional colors for the capsules.
102 std::optional<Collection<rerun::components::Color>> colors;
103
104 /// Optional text labels for the capsules, which will be located at their centers.
105 std::optional<Collection<rerun::components::Text>> labels;
106
107 /// Optional choice of whether the text labels should be shown by default.
108 std::optional<rerun::components::ShowLabels> show_labels;
109
110 /// Optional class ID for the ellipsoids.
111 ///
112 /// The class ID provides colors and labels if not specified explicitly.
113 std::optional<Collection<rerun::components::ClassId>> class_ids;
114
115 public:
116 static constexpr const char IndicatorComponentName[] =
117 "rerun.components.Capsules3DIndicator";
118
119 /// Indicator component, used to identify the archetype when converting to a list of components.
121
122 public: // START of extensions from capsules3d_ext.cpp:
123 /// Creates a new `Capsules3D` with the given axis-aligned lengths and radii.
124 ///
125 /// For multiple capsules, you should generally follow this with
126 /// `Capsules3D::with_translations()` and one of the rotation methods, in order to move them
127 /// apart from each other.
128 //
129 // TODO(andreas): This should not take an std::vector.
131 const std::vector<float>& lengths, const std::vector<float>& radii
132 );
133
134 /* TODO(kpreid): This should exist for parity with Rust, but actually implementing this
135 needs a bit of quaternion math.
136
137 /// Creates a new `Capsules3D` where each capsule extends between the given pairs of points.
138 //
139 // TODO(andreas): This should not take an std::vector.
140 //
141 static Capsules3D from_endpoints_and_radii(
142 const std::vector<datatypes::Vec3D>& start_points,
143 const std::vector<datatypes::Vec3D>& end_points,
144 const std::vector<float>& radii
145 );
146 */
147
148 // END of extensions from capsules3d_ext.cpp, start of generated code:
149
150 public:
151 Capsules3D() = default;
152 Capsules3D(Capsules3D&& other) = default;
153
154 /// Optional translations of the capsules.
155 ///
156 /// If not specified, one end of each capsule will be at (0, 0, 0).
157 /// Note that this uses a `components::PoseTranslation3D` which is also used by `archetypes::InstancePoses3D`.
159 ) && {
160 translations = std::move(_translations);
161 // See: https://github.com/rerun-io/rerun/issues/4027
162 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
163 }
164
165 /// Rotations via axis + angle.
166 ///
167 /// If no rotation is specified, the capsules align with the +Z axis of the local coordinate system.
168 /// Note that this uses a `components::PoseRotationAxisAngle` which is also used by `archetypes::InstancePoses3D`.
171 ) && {
172 rotation_axis_angles = std::move(_rotation_axis_angles);
173 // See: https://github.com/rerun-io/rerun/issues/4027
174 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
175 }
176
177 /// Rotations via quaternion.
178 ///
179 /// If no rotation is specified, the capsules align with the +Z axis of the local coordinate system.
180 /// Note that this uses a `components::PoseRotationQuat` which is also used by `archetypes::InstancePoses3D`.
182 ) && {
183 quaternions = std::move(_quaternions);
184 // See: https://github.com/rerun-io/rerun/issues/4027
185 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
186 }
187
188 /// Optional colors for the capsules.
190 colors = std::move(_colors);
191 // See: https://github.com/rerun-io/rerun/issues/4027
192 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
193 }
194
195 /// Optional text labels for the capsules, which will be located at their centers.
197 labels = std::move(_labels);
198 // See: https://github.com/rerun-io/rerun/issues/4027
199 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
200 }
201
202 /// Optional choice of whether the text labels should be shown by default.
204 show_labels = std::move(_show_labels);
205 // See: https://github.com/rerun-io/rerun/issues/4027
206 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
207 }
208
209 /// Optional class ID for the ellipsoids.
210 ///
211 /// The class ID provides colors and labels if not specified explicitly.
213 class_ids = std::move(_class_ids);
214 // See: https://github.com/rerun-io/rerun/issues/4027
215 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
216 }
217 };
218
219} // namespace rerun::archetypes
220
221namespace rerun {
222 /// \private
223 template <typename T>
224 struct AsComponents;
225
226 /// \private
227 template <>
228 struct AsComponents<archetypes::Capsules3D> {
229 /// Serialize all set component batches.
230 static Result<std::vector<ComponentBatch>> serialize(const archetypes::Capsules3D& archetype
231 );
232 };
233} // 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:77
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Archetype: 3D capsules; cylinders with hemispherical caps.
Definition capsules3d.hpp:76
Capsules3D with_translations(Collection< rerun::components::PoseTranslation3D > _translations) &&
Optional translations of the capsules.
Definition capsules3d.hpp:158
Capsules3D with_labels(Collection< rerun::components::Text > _labels) &&
Optional text labels for the capsules, which will be located at their centers.
Definition capsules3d.hpp:196
Collection< rerun::components::Radius > radii
Radii of the capsules.
Definition capsules3d.hpp:81
Capsules3D with_quaternions(Collection< rerun::components::PoseRotationQuat > _quaternions) &&
Rotations via quaternion.
Definition capsules3d.hpp:181
std::optional< rerun::components::ShowLabels > show_labels
Optional choice of whether the text labels should be shown by default.
Definition capsules3d.hpp:108
static Capsules3D from_lengths_and_radii(const std::vector< float > &lengths, const std::vector< float > &radii)
Creates a new Capsules3D with the given axis-aligned lengths and radii.
Capsules3D with_class_ids(Collection< rerun::components::ClassId > _class_ids) &&
Optional class ID for the ellipsoids.
Definition capsules3d.hpp:212
std::optional< Collection< rerun::components::ClassId > > class_ids
Optional class ID for the ellipsoids.
Definition capsules3d.hpp:113
std::optional< Collection< rerun::components::PoseRotationAxisAngle > > rotation_axis_angles
Rotations via axis + angle.
Definition capsules3d.hpp:93
std::optional< Collection< rerun::components::Text > > labels
Optional text labels for the capsules, which will be located at their centers.
Definition capsules3d.hpp:105
std::optional< Collection< rerun::components::PoseTranslation3D > > translations
Optional translations of the capsules.
Definition capsules3d.hpp:87
Capsules3D with_colors(Collection< rerun::components::Color > _colors) &&
Optional colors for the capsules.
Definition capsules3d.hpp:189
std::optional< Collection< rerun::components::Color > > colors
Optional colors for the capsules.
Definition capsules3d.hpp:102
std::optional< Collection< rerun::components::PoseRotationQuat > > quaternions
Rotations via quaternion.
Definition capsules3d.hpp:99
Capsules3D with_rotation_axis_angles(Collection< rerun::components::PoseRotationAxisAngle > _rotation_axis_angles) &&
Rotations via axis + angle.
Definition capsules3d.hpp:169
Collection< rerun::components::Length > lengths
Lengths of the capsules, defined as the distance between the centers of the endcaps.
Definition capsules3d.hpp:78
Capsules3D with_show_labels(rerun::components::ShowLabels _show_labels) &&
Optional choice of whether the text labels should be shown by default.
Definition capsules3d.hpp:203
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