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 "../datatypes/vec3d.hpp"
7#include "../result.hpp"
8
9#include <array>
10#include <cstdint>
11#include <memory>
12
13namespace rerun::components {
14 /// **Component**: Half-size (radius) of a 3D box.
15 ///
16 /// Measured in its local coordinate system.
17 ///
18 /// The box extends both in negative and positive direction along each axis.
19 /// Negative sizes indicate that the box is flipped along the respective axis, but this has no effect on how it is displayed.
20 struct HalfSize3D {
22
23 public: // START of extensions from half_size3d_ext.cpp:
24 /// Construct HalfSize3D from x/y/z values.
25 HalfSize3D(float x, float y, float z) : xyz{x, y, z} {}
26
27 float x() const {
28 return xyz.x();
29 }
30
31 float y() const {
32 return xyz.y();
33 }
34
35 float z() const {
36 return xyz.z();
37 }
38
39 // END of extensions from half_size3d_ext.cpp, start of generated code:
40
41 public:
42 HalfSize3D() = default;
43
44 HalfSize3D(rerun::datatypes::Vec3D xyz_) : xyz(xyz_) {}
45
46 HalfSize3D& operator=(rerun::datatypes::Vec3D xyz_) {
47 xyz = xyz_;
48 return *this;
49 }
50
51 HalfSize3D(std::array<float, 3> xyz_) : xyz(xyz_) {}
52
53 HalfSize3D& operator=(std::array<float, 3> xyz_) {
54 xyz = xyz_;
55 return *this;
56 }
57
58 /// Cast to the underlying Vec3D datatype
59 operator rerun::datatypes::Vec3D() const {
60 return xyz;
61 }
62 };
63} // namespace rerun::components
64
65namespace rerun {
66 static_assert(sizeof(rerun::datatypes::Vec3D) == sizeof(components::HalfSize3D));
67
68 /// \private
69 template <>
70 struct Loggable<components::HalfSize3D> {
71 static constexpr const char Name[] = "rerun.components.HalfSize3D";
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::Vec3D>::arrow_datatype();
76 }
77
78 /// Serializes an array of `rerun::components::HalfSize3D` into an arrow array.
79 static Result<std::shared_ptr<arrow::Array>> to_arrow(
80 const components::HalfSize3D* instances, size_t num_instances
81 ) {
82 if (num_instances == 0) {
83 return Loggable<rerun::datatypes::Vec3D>::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::Vec3D>::to_arrow(&instances->xyz, num_instances);
91 }
92 }
93 };
94} // 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: Half-size (radius) of a 3D box.
Definition half_size3d.hpp:20
HalfSize3D(float x, float y, float z)
Construct HalfSize3D from x/y/z values.
Definition half_size3d.hpp:25
Datatype: A vector in 3D space.
Definition vec3d.hpp:20