Rerun C++ SDK
Loading...
Searching...
No Matches
line_strips3d.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/line_strips3d.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/line_strip3d.hpp"
12#include "../components/radius.hpp"
13#include "../components/text.hpp"
14#include "../indicator_component.hpp"
15#include "../result.hpp"
16
17#include <cstdint>
18#include <optional>
19#include <utility>
20#include <vector>
21
22namespace rerun::archetypes {
23 /// **Archetype**: 3D line strips with positions and optional colors, radii, labels, etc.
24 ///
25 /// ## Examples
26 ///
27 /// ### Many strips
28 /// ![image](https://static.rerun.io/line_strip3d_batch/15e8ff18a6c95a3191acb0eae6eb04adea3b4874/full.png)
29 ///
30 /// ```cpp
31 /// #include <rerun.hpp>
32 ///
33 /// #include <vector>
34 ///
35 /// int main() {
36 /// const auto rec = rerun::RecordingStream("rerun_example_line_strip3d_batch");
37 /// rec.spawn().exit_on_failure();
38 ///
39 /// rerun::Collection<rerun::Vec3D> strip1 = {
40 /// {0.f, 0.f, 2.f},
41 /// {1.f, 0.f, 2.f},
42 /// {1.f, 1.f, 2.f},
43 /// {0.f, 1.f, 2.f},
44 /// };
45 /// rerun::Collection<rerun::Vec3D> strip2 = {
46 /// {0.f, 0.f, 0.f},
47 /// {0.f, 0.f, 1.f},
48 /// {1.f, 0.f, 0.f},
49 /// {1.f, 0.f, 1.f},
50 /// {1.f, 1.f, 0.f},
51 /// {1.f, 1.f, 1.f},
52 /// {0.f, 1.f, 0.f},
53 /// {0.f, 1.f, 1.f},
54 /// };
55 /// rec.log(
56 /// "strips",
57 /// rerun::LineStrips3D({strip1, strip2})
58 /// .with_colors({0xFF0000FF, 0x00FF00FF})
59 /// .with_radii({0.025f, 0.005f})
60 /// .with_labels({"one strip here", "and one strip there"})
61 /// );
62 /// }
63 /// ```
64 ///
65 /// ### Lines with scene & UI radius each
66 /// ![image](https://static.rerun.io/line_strip3d_ui_radius/36b98f47e45747b5a3601511ff39b8d74c61d120/full.png)
67 ///
68 /// ```cpp
69 /// #include <rerun.hpp>
70 ///
71 /// int main() {
72 /// const auto rec = rerun::RecordingStream("rerun_example_line_strip3d_ui_radius");
73 /// rec.spawn().exit_on_failure();
74 ///
75 /// // A blue line with a scene unit radii of 0.01.
76 /// rerun::LineStrip3D linestrip_blue(
77 /// {{0.f, 0.f, 0.f}, {0.f, 0.f, 1.f}, {1.f, 0.f, 0.f}, {1.f, 0.f, 1.f}}
78 /// );
79 /// rec.log(
80 /// "scene_unit_line",
81 /// rerun::LineStrips3D(linestrip_blue)
82 /// // By default, radii are interpreted as world-space units.
83 /// .with_radii(0.01f)
84 /// .with_colors(rerun::Color(0, 0, 255))
85 /// );
86 ///
87 /// // A red line with a ui point radii of 5.
88 /// // UI points are independent of zooming in Views, but are sensitive to the application UI scaling.
89 /// // For 100 % ui scaling, UI points are equal to pixels.
90 /// rerun::LineStrip3D linestrip_red(
91 /// {{3.f, 0.f, 0.f}, {3.f, 0.f, 1.f}, {4.f, 0.f, 0.f}, {4.f, 0.f, 1.f}}
92 /// );
93 /// rec.log(
94 /// "ui_points_line",
95 /// rerun::LineStrips3D(linestrip_red)
96 /// // By default, radii are interpreted as world-space units.
97 /// .with_radii(rerun::Radius::ui_points(5.0f))
98 /// .with_colors(rerun::Color(255, 0, 0))
99 /// );
100 /// }
101 /// ```
103 /// All the actual 3D line strips that make up the batch.
105
106 /// Optional radii for the line strips.
107 std::optional<Collection<rerun::components::Radius>> radii;
108
109 /// Optional colors for the line strips.
110 std::optional<Collection<rerun::components::Color>> colors;
111
112 /// Optional text labels for the line strips.
113 ///
114 /// If there's a single label present, it will be placed at the center of the entity.
115 /// Otherwise, each instance will have its own label.
116 std::optional<Collection<rerun::components::Text>> labels;
117
118 /// Optional `components::ClassId`s for the lines.
119 ///
120 /// The `components::ClassId` provides colors and labels if not specified explicitly.
121 std::optional<Collection<rerun::components::ClassId>> class_ids;
122
123 public:
124 static constexpr const char IndicatorComponentName[] =
125 "rerun.components.LineStrips3DIndicator";
126
127 /// Indicator component, used to identify the archetype when converting to a list of components.
129
130 public:
131 LineStrips3D() = default;
132 LineStrips3D(LineStrips3D&& other) = default;
133
135 : strips(std::move(_strips)) {}
136
137 /// Optional radii for the line strips.
139 radii = std::move(_radii);
140 // See: https://github.com/rerun-io/rerun/issues/4027
141 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
142 }
143
144 /// Optional colors for the line strips.
146 colors = std::move(_colors);
147 // See: https://github.com/rerun-io/rerun/issues/4027
148 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
149 }
150
151 /// Optional text labels for the line strips.
152 ///
153 /// If there's a single label present, it will be placed at the center of the entity.
154 /// Otherwise, each instance will have its own label.
156 labels = std::move(_labels);
157 // See: https://github.com/rerun-io/rerun/issues/4027
158 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
159 }
160
161 /// Optional `components::ClassId`s for the lines.
162 ///
163 /// The `components::ClassId` provides colors and labels if not specified explicitly.
165 class_ids = std::move(_class_ids);
166 // See: https://github.com/rerun-io/rerun/issues/4027
167 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
168 }
169 };
170
171} // namespace rerun::archetypes
172
173namespace rerun {
174 /// \private
175 template <typename T>
176 struct AsComponents;
177
178 /// \private
179 template <>
180 struct AsComponents<archetypes::LineStrips3D> {
181 /// Serialize all set component batches.
182 static Result<std::vector<ComponentBatch>> serialize(
183 const archetypes::LineStrips3D& archetype
184 );
185 };
186} // 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:72
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
Archetype: 3D line strips with positions and optional colors, radii, labels, etc.
Definition line_strips3d.hpp:102
LineStrips3D with_colors(Collection< rerun::components::Color > _colors) &&
Optional colors for the line strips.
Definition line_strips3d.hpp:145
std::optional< Collection< rerun::components::Radius > > radii
Optional radii for the line strips.
Definition line_strips3d.hpp:107
std::optional< Collection< rerun::components::Color > > colors
Optional colors for the line strips.
Definition line_strips3d.hpp:110
Collection< rerun::components::LineStrip3D > strips
All the actual 3D line strips that make up the batch.
Definition line_strips3d.hpp:104
std::optional< Collection< rerun::components::ClassId > > class_ids
Optional components::ClassIds for the lines.
Definition line_strips3d.hpp:121
std::optional< Collection< rerun::components::Text > > labels
Optional text labels for the line strips.
Definition line_strips3d.hpp:116
LineStrips3D with_labels(Collection< rerun::components::Text > _labels) &&
Optional text labels for the line strips.
Definition line_strips3d.hpp:155
LineStrips3D with_class_ids(Collection< rerun::components::ClassId > _class_ids) &&
Optional components::ClassIds for the lines.
Definition line_strips3d.hpp:164
LineStrips3D with_radii(Collection< rerun::components::Radius > _radii) &&
Optional radii for the line strips.
Definition line_strips3d.hpp:138
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:30