Rerun C++ SDK
Loading...
Searching...
No Matches
pose_transform_mat3x3.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/transform_mat3x3.fbs".
3
4#pragma once
5
6#include "../component_descriptor.hpp"
7#include "../datatypes/mat3x3.hpp"
8#include "../result.hpp"
9
10#include <array>
11#include <cstdint>
12#include <memory>
13
14namespace rerun::components {
15 /// **Component**: A 3x3 transformation matrix Matrix that doesn't propagate in the transform hierarchy.
16 ///
17 /// 3x3 matrixes are able to represent any affine transformation in 3D space,
18 /// i.e. rotation, scaling, shearing, reflection etc.
19 ///
20 /// Matrices in Rerun are stored as flat list of coefficients in column-major order:
21 /// ```text
22 /// column 0 column 1 column 2
23 /// -------------------------------------------------
24 /// row 0 | flat_columns[0] flat_columns[3] flat_columns[6]
25 /// row 1 | flat_columns[1] flat_columns[4] flat_columns[7]
26 /// row 2 | flat_columns[2] flat_columns[5] flat_columns[8]
27 /// ```
30
31 public:
32 PoseTransformMat3x3() = default;
33
34 PoseTransformMat3x3(rerun::datatypes::Mat3x3 matrix_) : matrix(matrix_) {}
35
37 matrix = matrix_;
38 return *this;
39 }
40
41 PoseTransformMat3x3(std::array<float, 9> flat_columns_) : matrix(flat_columns_) {}
42
43 PoseTransformMat3x3& operator=(std::array<float, 9> flat_columns_) {
44 matrix = flat_columns_;
45 return *this;
46 }
47
48 /// Cast to the underlying Mat3x3 datatype
49 operator rerun::datatypes::Mat3x3() const {
50 return matrix;
51 }
52 };
53} // namespace rerun::components
54
55namespace rerun {
56 static_assert(sizeof(rerun::datatypes::Mat3x3) == sizeof(components::PoseTransformMat3x3));
57
58 /// \private
59 template <>
60 struct Loggable<components::PoseTransformMat3x3> {
61 static constexpr ComponentDescriptor Descriptor = "rerun.components.PoseTransformMat3x3";
62
63 /// Returns the arrow data type this type corresponds to.
64 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
65 return Loggable<rerun::datatypes::Mat3x3>::arrow_datatype();
66 }
67
68 /// Serializes an array of `rerun::components::PoseTransformMat3x3` into an arrow array.
69 static Result<std::shared_ptr<arrow::Array>> to_arrow(
70 const components::PoseTransformMat3x3* instances, size_t num_instances
71 ) {
72 if (num_instances == 0) {
73 return Loggable<rerun::datatypes::Mat3x3>::to_arrow(nullptr, 0);
74 } else if (instances == nullptr) {
75 return rerun::Error(
76 ErrorCode::UnexpectedNullArgument,
77 "Passed array instances is null when num_elements> 0."
78 );
79 } else {
80 return Loggable<rerun::datatypes::Mat3x3>::to_arrow(
81 &instances->matrix,
82 num_instances
83 );
84 }
85 }
86 };
87} // 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 3x3 transformation matrix Matrix that doesn't propagate in the transform hierarchy.
Definition pose_transform_mat3x3.hpp:28
Datatype: A 3x3 Matrix.
Definition mat3x3.hpp:32