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 "../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.
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: // START of extensions from transform_mat3x3_ext.cpp:
32 TransformMat3x3(const rerun::datatypes::Vec3D (&columns)[3]) : matrix(columns) {}
33
34 // END of extensions from transform_mat3x3_ext.cpp, start of generated code:
35
36 public:
37 TransformMat3x3() = default;
38
39 TransformMat3x3(rerun::datatypes::Mat3x3 matrix_) : matrix(matrix_) {}
40
41 TransformMat3x3& operator=(rerun::datatypes::Mat3x3 matrix_) {
42 matrix = matrix_;
43 return *this;
44 }
45
46 TransformMat3x3(std::array<float, 9> flat_columns_) : matrix(flat_columns_) {}
47
48 TransformMat3x3& operator=(std::array<float, 9> flat_columns_) {
49 matrix = flat_columns_;
50 return *this;
51 }
52
53 /// Cast to the underlying Mat3x3 datatype
54 operator rerun::datatypes::Mat3x3() const {
55 return matrix;
56 }
57 };
58} // namespace rerun::components
59
60namespace rerun {
61 static_assert(sizeof(rerun::datatypes::Mat3x3) == sizeof(components::TransformMat3x3));
62
63 /// \private
64 template <>
65 struct Loggable<components::TransformMat3x3> {
66 static constexpr ComponentDescriptor Descriptor = "rerun.components.TransformMat3x3";
67
68 /// Returns the arrow data type this type corresponds to.
69 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
70 return Loggable<rerun::datatypes::Mat3x3>::arrow_datatype();
71 }
72
73 /// Serializes an array of `rerun::components::TransformMat3x3` into an arrow array.
74 static Result<std::shared_ptr<arrow::Array>> to_arrow(
75 const components::TransformMat3x3* instances, size_t num_instances
76 ) {
77 if (num_instances == 0) {
78 return Loggable<rerun::datatypes::Mat3x3>::to_arrow(nullptr, 0);
79 } else if (instances == nullptr) {
80 return rerun::Error(
81 ErrorCode::UnexpectedNullArgument,
82 "Passed array instances is null when num_elements> 0."
83 );
84 } else {
85 return Loggable<rerun::datatypes::Mat3x3>::to_arrow(
86 &instances->matrix,
87 num_instances
88 );
89 }
90 }
91 };
92} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:96
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:23
Component: A 3x3 transformation matrix Matrix.
Definition transform_mat3x3.hpp:28
Datatype: A 3x3 Matrix.
Definition mat3x3.hpp:32
Datatype: A vector in 3D space.
Definition vec3d.hpp:21