Rerun C++ SDK
Loading...
Searching...
No Matches
ellipsoids3d.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/ellipsoids3d.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/fill_mode.hpp"
12#include "../components/half_size3d.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 ellipsoids or spheres.
29 ///
30 /// This archetype is for ellipsoids or spheres whose size is a key part of the data
31 /// (e.g. a bounding sphere).
32 /// For points whose radii are for the sake of visualization, use `archetypes::Points3D` instead.
33 ///
34 /// Note that orienting and placing the ellipsoids/spheres is handled via `[archetypes.InstancePoses3D]`.
35 /// Some of its component are repeated here for convenience.
36 /// If there's more instance poses than half sizes, the last half size will be repeated for the remaining poses.
37 ///
38 /// ## Example
39 ///
40 /// ### Covariance ellipsoid
41 /// ![image](https://static.rerun.io/elliopsoid3d_simple/bd5d46e61b80ae44792b52ee07d750a7137002ea/full.png)
42 ///
43 /// ```cpp
44 /// #include <rerun.hpp>
45 ///
46 /// #include <algorithm>
47 /// #include <random>
48 /// #include <vector>
49 ///
50 /// int main() {
51 /// const auto rec = rerun::RecordingStream("rerun_example_ellipsoid_simple");
52 /// rec.spawn().exit_on_failure();
53 ///
54 /// const float sigmas[3] = {5.0f, 3.0f, 1.0f};
55 ///
56 /// std::default_random_engine gen;
57 /// std::normal_distribution<float> dist(0.0, 1.0f);
58 ///
59 /// std::vector<rerun::Position3D> points3d(50000);
60 /// std::generate(points3d.begin(), points3d.end(), [&] {
61 /// return rerun::Position3D(
62 /// sigmas[0] * dist(gen),
63 /// sigmas[1] * dist(gen),
64 /// sigmas[2] * dist(gen)
65 /// );
66 /// });
67 ///
68 /// rec.log(
69 /// "points",
70 /// rerun::Points3D(points3d).with_radii(0.02f).with_colors(rerun::Rgba32(188, 77, 185))
71 /// );
72 ///
73 /// rec.log(
74 /// "ellipsoid",
75 /// rerun::Ellipsoids3D::from_centers_and_half_sizes(
76 /// {
77 /// {0.0f, 0.0f, 0.0f},
78 /// {0.0f, 0.0f, 0.0f},
79 /// },
80 /// {
81 /// {sigmas[0], sigmas[1], sigmas[2]},
82 /// {3.0f * sigmas[0], 3.0f * sigmas[1], 3.0f * sigmas[2]},
83 /// }
84 /// )
85 /// .with_colors({
86 /// rerun::Rgba32(255, 255, 0),
87 /// rerun::Rgba32(64, 64, 0),
88 /// })
89 /// );
90 /// }
91 /// ```
92 struct Ellipsoids3D {
93 /// For each ellipsoid, half of its size on its three axes.
94 ///
95 /// If all components are equal, then it is a sphere with that radius.
97
98 /// Optional center positions of the ellipsoids.
99 ///
100 /// If not specified, the centers will be at (0, 0, 0).
101 /// Note that this uses a `components::PoseTranslation3D` which is also used by `archetypes::InstancePoses3D`.
102 std::optional<Collection<rerun::components::PoseTranslation3D>> centers;
103
104 /// Rotations via axis + angle.
105 ///
106 /// If no rotation is specified, the axes of the ellipsoid align with the axes of the local coordinate system.
107 /// Note that this uses a `components::PoseRotationAxisAngle` which is also used by `archetypes::InstancePoses3D`.
108 std::optional<Collection<rerun::components::PoseRotationAxisAngle>> rotation_axis_angles;
109
110 /// Rotations via quaternion.
111 ///
112 /// If no rotation is specified, the axes of the ellipsoid align with the axes of the local coordinate system.
113 /// Note that this uses a `components::PoseRotationQuat` which is also used by `archetypes::InstancePoses3D`.
114 std::optional<Collection<rerun::components::PoseRotationQuat>> quaternions;
115
116 /// Optional colors for the ellipsoids.
117 std::optional<Collection<rerun::components::Color>> colors;
118
119 /// Optional radii for the lines used when the ellipsoid is rendered as a wireframe.
120 std::optional<Collection<rerun::components::Radius>> line_radii;
121
122 /// Optionally choose whether the ellipsoids are drawn with lines or solid.
123 std::optional<rerun::components::FillMode> fill_mode;
124
125 /// Optional text labels for the ellipsoids.
126 std::optional<Collection<rerun::components::Text>> labels;
127
128 /// Optional choice of whether the text labels should be shown by default.
129 std::optional<rerun::components::ShowLabels> show_labels;
130
131 /// Optional class ID for the ellipsoids.
132 ///
133 /// The class ID provides colors and labels if not specified explicitly.
134 std::optional<Collection<rerun::components::ClassId>> class_ids;
135
136 public:
137 static constexpr const char IndicatorComponentName[] =
138 "rerun.components.Ellipsoids3DIndicator";
139
140 /// Indicator component, used to identify the archetype when converting to a list of components.
142
143 public: // START of extensions from ellipsoids3d_ext.cpp:
144 /// Creates new `Ellipsoids3D` that are spheres, with `half_sizes` created from radii.
145 //
146 // TODO(andreas): This should not take an std::vector.
147 static Ellipsoids3D from_radii(const std::vector<float>& sizes);
148
149 /// Creates new `Ellipsoids3D` that are spheres, with `half_sizes` and `centers` created
150 /// from centers and radii.
151 //
152 // TODO(andreas): This should not take an std::vector.
154 const std::vector<datatypes::Vec3D>& centers, const std::vector<float>& radii
155 );
156
157 /// Creates new `Ellipsoids3D` with `half_sizes` centered around the local origin.
159 Ellipsoids3D ellipsoids;
160 ellipsoids.half_sizes = std::move(half_sizes);
161 return ellipsoids;
162 }
163
164 /// Creates new `Ellipsoids3D` with `centers` and `half_sizes`.
168 ) {
169 Ellipsoids3D ellipsoids;
170 ellipsoids.half_sizes = std::move(half_sizes);
171 ellipsoids.centers = std::move(centers);
172 return ellipsoids;
173 }
174
175 // END of extensions from ellipsoids3d_ext.cpp, start of generated code:
176
177 public:
178 Ellipsoids3D() = default;
179 Ellipsoids3D(Ellipsoids3D&& other) = default;
180
181 /// Optional center positions of the ellipsoids.
182 ///
183 /// If not specified, the centers will be at (0, 0, 0).
184 /// Note that this uses a `components::PoseTranslation3D` which is also used by `archetypes::InstancePoses3D`.
186 centers = std::move(_centers);
187 // See: https://github.com/rerun-io/rerun/issues/4027
188 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
189 }
190
191 /// Rotations via axis + angle.
192 ///
193 /// If no rotation is specified, the axes of the ellipsoid align with the axes of the local coordinate system.
194 /// Note that this uses a `components::PoseRotationAxisAngle` which is also used by `archetypes::InstancePoses3D`.
197 ) && {
198 rotation_axis_angles = std::move(_rotation_axis_angles);
199 // See: https://github.com/rerun-io/rerun/issues/4027
200 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
201 }
202
203 /// Rotations via quaternion.
204 ///
205 /// If no rotation is specified, the axes of the ellipsoid align with the axes of the local coordinate system.
206 /// Note that this uses a `components::PoseRotationQuat` which is also used by `archetypes::InstancePoses3D`.
208 ) && {
209 quaternions = std::move(_quaternions);
210 // See: https://github.com/rerun-io/rerun/issues/4027
211 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
212 }
213
214 /// Optional colors for the ellipsoids.
216 colors = std::move(_colors);
217 // See: https://github.com/rerun-io/rerun/issues/4027
218 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
219 }
220
221 /// Optional radii for the lines used when the ellipsoid is rendered as a wireframe.
223 line_radii = std::move(_line_radii);
224 // See: https://github.com/rerun-io/rerun/issues/4027
225 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
226 }
227
228 /// Optionally choose whether the ellipsoids are drawn with lines or solid.
230 fill_mode = std::move(_fill_mode);
231 // See: https://github.com/rerun-io/rerun/issues/4027
232 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
233 }
234
235 /// Optional text labels for the ellipsoids.
237 labels = std::move(_labels);
238 // See: https://github.com/rerun-io/rerun/issues/4027
239 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
240 }
241
242 /// Optional choice of whether the text labels should be shown by default.
244 show_labels = std::move(_show_labels);
245 // See: https://github.com/rerun-io/rerun/issues/4027
246 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
247 }
248
249 /// Optional class ID for the ellipsoids.
250 ///
251 /// The class ID provides colors and labels if not specified explicitly.
253 class_ids = std::move(_class_ids);
254 // See: https://github.com/rerun-io/rerun/issues/4027
255 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
256 }
257 };
258
259} // namespace rerun::archetypes
260
261namespace rerun {
262 /// \private
263 template <typename T>
264 struct AsComponents;
265
266 /// \private
267 template <>
268 struct AsComponents<archetypes::Ellipsoids3D> {
269 /// Serialize all set component batches.
270 static Result<std::vector<ComponentBatch>> serialize(
271 const archetypes::Ellipsoids3D& archetype
272 );
273 };
274} // 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
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
Archetype: 3D ellipsoids or spheres.
Definition ellipsoids3d.hpp:92
Collection< rerun::components::HalfSize3D > half_sizes
For each ellipsoid, half of its size on its three axes.
Definition ellipsoids3d.hpp:96
std::optional< Collection< rerun::components::PoseTranslation3D > > centers
Optional center positions of the ellipsoids.
Definition ellipsoids3d.hpp:102
static Ellipsoids3D from_centers_and_radii(const std::vector< datatypes::Vec3D > &centers, const std::vector< float > &radii)
Creates new Ellipsoids3D that are spheres, with half_sizes and centers created from centers and radii...
std::optional< Collection< rerun::components::ClassId > > class_ids
Optional class ID for the ellipsoids.
Definition ellipsoids3d.hpp:134
std::optional< Collection< rerun::components::Text > > labels
Optional text labels for the ellipsoids.
Definition ellipsoids3d.hpp:126
Ellipsoids3D with_rotation_axis_angles(Collection< rerun::components::PoseRotationAxisAngle > _rotation_axis_angles) &&
Rotations via axis + angle.
Definition ellipsoids3d.hpp:195
std::optional< rerun::components::FillMode > fill_mode
Optionally choose whether the ellipsoids are drawn with lines or solid.
Definition ellipsoids3d.hpp:123
Ellipsoids3D with_labels(Collection< rerun::components::Text > _labels) &&
Optional text labels for the ellipsoids.
Definition ellipsoids3d.hpp:236
Ellipsoids3D with_colors(Collection< rerun::components::Color > _colors) &&
Optional colors for the ellipsoids.
Definition ellipsoids3d.hpp:215
Ellipsoids3D with_centers(Collection< rerun::components::PoseTranslation3D > _centers) &&
Optional center positions of the ellipsoids.
Definition ellipsoids3d.hpp:185
Ellipsoids3D with_fill_mode(rerun::components::FillMode _fill_mode) &&
Optionally choose whether the ellipsoids are drawn with lines or solid.
Definition ellipsoids3d.hpp:229
static Ellipsoids3D from_centers_and_half_sizes(Collection< components::PoseTranslation3D > centers, Collection< components::HalfSize3D > half_sizes)
Creates new Ellipsoids3D with centers and half_sizes.
Definition ellipsoids3d.hpp:165
static Ellipsoids3D from_radii(const std::vector< float > &sizes)
Creates new Ellipsoids3D that are spheres, with half_sizes created from radii.
std::optional< Collection< rerun::components::PoseRotationAxisAngle > > rotation_axis_angles
Rotations via axis + angle.
Definition ellipsoids3d.hpp:108
Ellipsoids3D with_quaternions(Collection< rerun::components::PoseRotationQuat > _quaternions) &&
Rotations via quaternion.
Definition ellipsoids3d.hpp:207
Ellipsoids3D with_class_ids(Collection< rerun::components::ClassId > _class_ids) &&
Optional class ID for the ellipsoids.
Definition ellipsoids3d.hpp:252
std::optional< rerun::components::ShowLabels > show_labels
Optional choice of whether the text labels should be shown by default.
Definition ellipsoids3d.hpp:129
Ellipsoids3D with_show_labels(rerun::components::ShowLabels _show_labels) &&
Optional choice of whether the text labels should be shown by default.
Definition ellipsoids3d.hpp:243
static Ellipsoids3D from_half_sizes(Collection< components::HalfSize3D > half_sizes)
Creates new Ellipsoids3D with half_sizes centered around the local origin.
Definition ellipsoids3d.hpp:158
std::optional< Collection< rerun::components::Radius > > line_radii
Optional radii for the lines used when the ellipsoid is rendered as a wireframe.
Definition ellipsoids3d.hpp:120
std::optional< Collection< rerun::components::Color > > colors
Optional colors for the ellipsoids.
Definition ellipsoids3d.hpp:117
std::optional< Collection< rerun::components::PoseRotationQuat > > quaternions
Rotations via quaternion.
Definition ellipsoids3d.hpp:114
Ellipsoids3D with_line_radii(Collection< rerun::components::Radius > _line_radii) &&
Optional radii for the lines used when the ellipsoid is rendered as a wireframe.
Definition ellipsoids3d.hpp:222
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