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