Rerun C++ SDK
Loading...
Searching...
No Matches
half_sizes3d.hpp
1// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/re_types/definitions/rerun/components/half_sizes3d.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-sizes (extents) of a 3D box along its local axis, starting at its local origin/center.
15 ///
16 /// The box extends both in negative and positive direction along each axis.
17 /// Negative sizes indicate that the box is flipped along the respective axis, but this has no effect on how it is displayed.
18 struct HalfSizes3D {
20
21 public:
22 // Extensions to generated type defined in 'half_sizes3d_ext.cpp'
23
24 /// Construct HalfSizes3D from x/y/z values.
25 HalfSizes3D(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 public:
40 HalfSizes3D() = default;
41
42 HalfSizes3D(rerun::datatypes::Vec3D xyz_) : xyz(xyz_) {}
43
44 HalfSizes3D& operator=(rerun::datatypes::Vec3D xyz_) {
45 xyz = xyz_;
46 return *this;
47 }
48
49 HalfSizes3D(std::array<float, 3> xyz_) : xyz(xyz_) {}
50
51 HalfSizes3D& operator=(std::array<float, 3> xyz_) {
52 xyz = xyz_;
53 return *this;
54 }
55
56 /// Cast to the underlying Vec3D datatype
57 operator rerun::datatypes::Vec3D() const {
58 return xyz;
59 }
60 };
61} // namespace rerun::components
62
63namespace rerun {
64 static_assert(sizeof(rerun::datatypes::Vec3D) == sizeof(components::HalfSizes3D));
65
66 /// \private
67 template <>
68 struct Loggable<components::HalfSizes3D> {
69 static constexpr const char Name[] = "rerun.components.HalfSizes3D";
70
71 /// Returns the arrow data type this type corresponds to.
72 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
73 return Loggable<rerun::datatypes::Vec3D>::arrow_datatype();
74 }
75
76 /// Serializes an array of `rerun::components::HalfSizes3D` into an arrow array.
77 static Result<std::shared_ptr<arrow::Array>> to_arrow(
78 const components::HalfSizes3D* instances, size_t num_instances
79 ) {
80 return Loggable<rerun::datatypes::Vec3D>::to_arrow(&instances->xyz, num_instances);
81 }
82 };
83} // namespace rerun
All built-in components. See Types in the Rerun manual.
Definition rerun.hpp:75
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:21
Component: Half-sizes (extents) of a 3D box along its local axis, starting at its local origin/center...
Definition half_sizes3d.hpp:18
HalfSizes3D(float x, float y, float z)
Construct HalfSizes3D from x/y/z values.
Definition half_sizes3d.hpp:25
Datatype: A vector in 3D space.
Definition vec3d.hpp:20