Rerun C++ SDK
Loading...
Searching...
No Matches
half_size3d.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/half_size3d.fbs".
3
4#pragma once
5
6#include "../component_descriptor.hpp"
7#include "../datatypes/vec3d.hpp"
8#include "../result.hpp"
9
10#include <array>
11#include <cstdint>
12#include <memory>
13
14namespace rerun::components {
15 /// **Component**: Half-size (radius) of a 3D box.
16 ///
17 /// Measured in its local coordinate system.
18 ///
19 /// The box extends both in negative and positive direction along each axis.
20 /// Negative sizes indicate that the box is flipped along the respective axis, but this has no effect on how it is displayed.
21 struct HalfSize3D {
23
24 public: // START of extensions from half_size3d_ext.cpp:
25 /// Construct HalfSize3D from x/y/z values.
26 HalfSize3D(float x, float y, float z) : xyz{x, y, z} {}
27
28 float x() const {
29 return xyz.x();
30 }
31
32 float y() const {
33 return xyz.y();
34 }
35
36 float z() const {
37 return xyz.z();
38 }
39
40 // END of extensions from half_size3d_ext.cpp, start of generated code:
41
42 public:
43 HalfSize3D() = default;
44
45 HalfSize3D(rerun::datatypes::Vec3D xyz_) : xyz(xyz_) {}
46
47 HalfSize3D& operator=(rerun::datatypes::Vec3D xyz_) {
48 xyz = xyz_;
49 return *this;
50 }
51
52 HalfSize3D(std::array<float, 3> xyz_) : xyz(xyz_) {}
53
54 HalfSize3D& operator=(std::array<float, 3> xyz_) {
55 xyz = xyz_;
56 return *this;
57 }
58
59 /// Cast to the underlying Vec3D datatype
60 operator rerun::datatypes::Vec3D() const {
61 return xyz;
62 }
63 };
64} // namespace rerun::components
65
66namespace rerun {
67 static_assert(sizeof(rerun::datatypes::Vec3D) == sizeof(components::HalfSize3D));
68
69 /// \private
70 template <>
71 struct Loggable<components::HalfSize3D> {
72 static constexpr ComponentDescriptor Descriptor = "rerun.components.HalfSize3D";
73
74 /// Returns the arrow data type this type corresponds to.
75 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
76 return Loggable<rerun::datatypes::Vec3D>::arrow_datatype();
77 }
78
79 /// Serializes an array of `rerun::components::HalfSize3D` into an arrow array.
80 static Result<std::shared_ptr<arrow::Array>> to_arrow(
81 const components::HalfSize3D* instances, size_t num_instances
82 ) {
83 if (num_instances == 0) {
84 return Loggable<rerun::datatypes::Vec3D>::to_arrow(nullptr, 0);
85 } else if (instances == nullptr) {
86 return rerun::Error(
87 ErrorCode::UnexpectedNullArgument,
88 "Passed array instances is null when num_elements> 0."
89 );
90 } else {
91 return Loggable<rerun::datatypes::Vec3D>::to_arrow(&instances->xyz, num_instances);
92 }
93 }
94 };
95} // 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:80
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Component: Half-size (radius) of a 3D box.
Definition half_size3d.hpp:21
HalfSize3D(float x, float y, float z)
Construct HalfSize3D from x/y/z values.
Definition half_size3d.hpp:26
Datatype: A vector in 3D space.
Definition vec3d.hpp:21