Rerun C++ SDK
Loading...
Searching...
No Matches
voxel_size.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_sdk_types/definitions/rerun/components/voxel_size.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**: The scene-unit dimensions of one voxel in a sparse 3D voxel grid.
15 ///
16 /// Each component is the size of a voxel along the corresponding local grid axis.
17 /// All components must be finite and positive.
18 struct VoxelSize {
20
21 public:
22 VoxelSize() = default;
23
24 VoxelSize(rerun::datatypes::Vec3D xyz_) : xyz(xyz_) {}
25
26 VoxelSize& operator=(rerun::datatypes::Vec3D xyz_) {
27 xyz = xyz_;
28 return *this;
29 }
30
31 VoxelSize(std::array<float, 3> xyz_) : xyz(xyz_) {}
32
33 VoxelSize& operator=(std::array<float, 3> xyz_) {
34 xyz = xyz_;
35 return *this;
36 }
37
38 /// Cast to the underlying Vec3D datatype
39 operator rerun::datatypes::Vec3D() const {
40 return xyz;
41 }
42 };
43} // namespace rerun::components
44
45namespace rerun {
46 static_assert(sizeof(rerun::datatypes::Vec3D) == sizeof(components::VoxelSize));
47
48 /// \private
49 template <>
50 struct Loggable<components::VoxelSize> {
51 static constexpr std::string_view ComponentType = "rerun.components.VoxelSize";
52
53 /// Returns the arrow data type this type corresponds to.
54 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
55 return Loggable<rerun::datatypes::Vec3D>::arrow_datatype();
56 }
57
58 /// Serializes an array of `rerun::components::VoxelSize` into an arrow array.
59 static Result<std::shared_ptr<arrow::Array>> to_arrow(
60 const components::VoxelSize* instances, size_t num_instances
61 ) {
62 if (num_instances == 0) {
63 return Loggable<rerun::datatypes::Vec3D>::to_arrow(nullptr, 0);
64 } else if (instances == nullptr) {
65 return rerun::Error(
66 ErrorCode::UnexpectedNullArgument,
67 "Passed array instances is null when num_elements> 0."
68 );
69 } else {
70 return Loggable<rerun::datatypes::Vec3D>::to_arrow(&instances->xyz, num_instances);
71 }
72 }
73 };
74} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:103
All built-in components. See Types in the Rerun manual.
Definition rerun.hpp:90
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Component: The scene-unit dimensions of one voxel in a sparse 3D voxel grid.
Definition voxel_size.hpp:18
Datatype: A vector in 3D space.
Definition vec3d.hpp:20