Rerun C++ SDK
Loading...
Searching...
No Matches
pose_scale3d.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/scale3d.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**: A 3D scale factor that doesn't propagate in the transform hierarchy.
16 ///
17 /// A scale of 1.0 means no scaling.
18 /// A scale of 2.0 means doubling the size.
19 /// Each component scales along the corresponding axis.
20 struct PoseScale3D {
22
23 public: // START of extensions from pose_scale3d_ext.cpp:
24 /// Construct `PoseScale3D` from x/y/z values.
25 PoseScale3D(float x, float y, float z) : scale{x, y, z} {}
26
27 /// Construct `PoseScale3D` from x/y/z float pointer.
28 explicit PoseScale3D(const float* xyz) : scale{xyz[0], xyz[1], xyz[2]} {}
29
30 /// Construct a `PoseScale3D` from a uniform scale factor.
31 explicit PoseScale3D(float uniform_scale)
32 : PoseScale3D(datatypes::Vec3D{uniform_scale, uniform_scale, uniform_scale}) {}
33
34 /// Explicitly construct a `PoseScale3D` from a uniform scale factor.
35 static PoseScale3D uniform(float uniform_scale) {
36 return PoseScale3D(uniform_scale);
37 }
38
39 /// Explicitly construct a `PoseScale3D` from a 3D scale factor.
41 return PoseScale3D(scale);
42 }
43
44 // END of extensions from pose_scale3d_ext.cpp, start of generated code:
45
46 public:
47 PoseScale3D() = default;
48
49 PoseScale3D(rerun::datatypes::Vec3D scale_) : scale(scale_) {}
50
51 PoseScale3D& operator=(rerun::datatypes::Vec3D scale_) {
52 scale = scale_;
53 return *this;
54 }
55
56 PoseScale3D(std::array<float, 3> xyz_) : scale(xyz_) {}
57
58 PoseScale3D& operator=(std::array<float, 3> xyz_) {
59 scale = xyz_;
60 return *this;
61 }
62
63 /// Cast to the underlying Vec3D datatype
64 operator rerun::datatypes::Vec3D() const {
65 return scale;
66 }
67 };
68} // namespace rerun::components
69
70namespace rerun {
71 static_assert(sizeof(rerun::datatypes::Vec3D) == sizeof(components::PoseScale3D));
72
73 /// \private
74 template <>
75 struct Loggable<components::PoseScale3D> {
76 static constexpr ComponentDescriptor Descriptor = "rerun.components.PoseScale3D";
77
78 /// Returns the arrow data type this type corresponds to.
79 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
80 return Loggable<rerun::datatypes::Vec3D>::arrow_datatype();
81 }
82
83 /// Serializes an array of `rerun::components::PoseScale3D` into an arrow array.
84 static Result<std::shared_ptr<arrow::Array>> to_arrow(
85 const components::PoseScale3D* instances, size_t num_instances
86 ) {
87 if (num_instances == 0) {
88 return Loggable<rerun::datatypes::Vec3D>::to_arrow(nullptr, 0);
89 } else if (instances == nullptr) {
90 return rerun::Error(
91 ErrorCode::UnexpectedNullArgument,
92 "Passed array instances is null when num_elements> 0."
93 );
94 } else {
95 return Loggable<rerun::datatypes::Vec3D>::to_arrow(
96 &instances->scale,
97 num_instances
98 );
99 }
100 }
101 };
102} // 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: A 3D scale factor that doesn't propagate in the transform hierarchy.
Definition pose_scale3d.hpp:20
PoseScale3D(float x, float y, float z)
Construct PoseScale3D from x/y/z values.
Definition pose_scale3d.hpp:25
PoseScale3D(const float *xyz)
Construct PoseScale3D from x/y/z float pointer.
Definition pose_scale3d.hpp:28
static PoseScale3D three_d(datatypes::Vec3D scale)
Explicitly construct a PoseScale3D from a 3D scale factor.
Definition pose_scale3d.hpp:40
static PoseScale3D uniform(float uniform_scale)
Explicitly construct a PoseScale3D from a uniform scale factor.
Definition pose_scale3d.hpp:35
PoseScale3D(float uniform_scale)
Construct a PoseScale3D from a uniform scale factor.
Definition pose_scale3d.hpp:31
Datatype: A vector in 3D space.
Definition vec3d.hpp:21