Rerun C++ SDK
Loading...
Searching...
No Matches
radius.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/components/radius.fbs".
3
4#pragma once
5
6#include "../datatypes/float32.hpp"
7#include "../result.hpp"
8
9#include <cstdint>
10#include <memory>
11
12namespace rerun::components {
13 /// **Component**: The radius of something, e.g. a point.
14 ///
15 /// Internally, positive values indicate scene units, whereas negative values
16 /// are interpreted as UI points.
17 ///
18 /// UI points are independent of zooming in Views, but are sensitive to the application UI scaling.
19 /// at 100% UI scaling, UI points are equal to pixels
20 /// The Viewer's UI scaling defaults to the OS scaling which typically is 100% for full HD screens and 200% for 4k screens.
21 struct Radius {
23
24 public: // START of extensions from radius_ext.cpp:
25 /// Creates a new radius in scene units.
26 ///
27 /// Values passed must be finite positive.
28 static Radius scene_units(float radius_in_scene_units) {
29 return Radius(radius_in_scene_units);
30 }
31
32 /// Creates a new radius in ui points.
33 ///
34 /// Values passed must be finite positive.
35 static Radius ui_points(float radius_in_ui_points) {
36 return Radius(-radius_in_ui_points);
37 }
38
39 // END of extensions from radius_ext.cpp, start of generated code:
40
41 public:
42 Radius() = default;
43
44 Radius(rerun::datatypes::Float32 value_) : value(value_) {}
45
46 Radius& operator=(rerun::datatypes::Float32 value_) {
47 value = value_;
48 return *this;
49 }
50
51 Radius(float value_) : value(value_) {}
52
53 Radius& operator=(float value_) {
54 value = value_;
55 return *this;
56 }
57
58 /// Cast to the underlying Float32 datatype
59 operator rerun::datatypes::Float32() const {
60 return value;
61 }
62 };
63} // namespace rerun::components
64
65namespace rerun {
66 static_assert(sizeof(rerun::datatypes::Float32) == sizeof(components::Radius));
67
68 /// \private
69 template <>
70 struct Loggable<components::Radius> {
71 static constexpr const char Name[] = "rerun.components.Radius";
72
73 /// Returns the arrow data type this type corresponds to.
74 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
75 return Loggable<rerun::datatypes::Float32>::arrow_datatype();
76 }
77
78 /// Serializes an array of `rerun::components::Radius` into an arrow array.
79 static Result<std::shared_ptr<arrow::Array>> to_arrow(
80 const components::Radius* instances, size_t num_instances
81 ) {
82 if (num_instances == 0) {
83 return Loggable<rerun::datatypes::Float32>::to_arrow(nullptr, 0);
84 } else if (instances == nullptr) {
85 return rerun::Error(
86 ErrorCode::UnexpectedNullArgument,
87 "Passed array instances is null when num_elements> 0."
88 );
89 } else {
90 return Loggable<rerun::datatypes::Float32>::to_arrow(
91 &instances->value,
92 num_instances
93 );
94 }
95 }
96 };
97} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:95
All built-in components. See Types in the Rerun manual.
Definition rerun.hpp:79
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
Component: The radius of something, e.g.
Definition radius.hpp:21
static Radius ui_points(float radius_in_ui_points)
Creates a new radius in ui points.
Definition radius.hpp:35
static Radius scene_units(float radius_in_scene_units)
Creates a new radius in scene units.
Definition radius.hpp:28
Datatype: A single-precision 32-bit IEEE 754 floating point number.
Definition float32.hpp:24