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