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