Rerun C++ SDK
Loading...
Searching...
No Matches
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/datatypes/mat3x3.fbs".
3
4#pragma once
5
6#include "../component_descriptor.hpp"
7#include "../rerun_sdk_export.hpp"
8#include "../result.hpp"
9#include "vec3d.hpp"
10
11#include <array>
12#include <cstdint>
13#include <memory>
14
15namespace arrow {
16 class Array;
17 class DataType;
18 class FixedSizeListBuilder;
19} // namespace arrow
20
21namespace rerun::datatypes {
22 /// **Datatype**: A 3x3 Matrix.
23 ///
24 /// Matrices in Rerun are stored as flat list of coefficients in column-major order:
25 /// ```text
26 /// column 0 column 1 column 2
27 /// -------------------------------------------------
28 /// row 0 | flat_columns[0] flat_columns[3] flat_columns[6]
29 /// row 1 | flat_columns[1] flat_columns[4] flat_columns[7]
30 /// row 2 | flat_columns[2] flat_columns[5] flat_columns[8]
31 /// ```
32 struct Mat3x3 {
33 /// Flat list of matrix coefficients in column-major order.
34 std::array<float, 9> flat_columns;
35
36 public: // START of extensions from mat3x3_ext.cpp:
37 static const Mat3x3 IDENTITY;
38 static const Mat3x3 INVALID;
39
40 /// Creates a new 3x3 matrix from 3 *columns* of 3 elements each.
41 Mat3x3(const Vec3D (&columns)[3])
43 columns[0].x(),
44 columns[0].y(),
45 columns[0].z(),
46 columns[1].x(),
47 columns[1].y(),
48 columns[1].z(),
49 columns[2].x(),
50 columns[2].y(),
51 columns[2].z(),
52 } {}
53
54 /// Construct a new 3x3 matrix from a pointer to 9 floats (in column major order).
55 explicit Mat3x3(const float* elements)
57 elements[0],
58 elements[1],
59 elements[2],
60 elements[3],
61 elements[4],
62 elements[5],
63 elements[6],
64 elements[7],
65 elements[8],
66 } {}
67
68 // END of extensions from mat3x3_ext.cpp, start of generated code:
69
70 public:
71 Mat3x3() = default;
72
73 Mat3x3(std::array<float, 9> flat_columns_) : flat_columns(flat_columns_) {}
74
75 Mat3x3& operator=(std::array<float, 9> flat_columns_) {
76 flat_columns = flat_columns_;
77 return *this;
78 }
79 };
80} // namespace rerun::datatypes
81
82namespace rerun {
83 template <typename T>
84 struct Loggable;
85
86 /// \private
87 template <>
88 struct Loggable<datatypes::Mat3x3> {
89 static constexpr ComponentDescriptor Descriptor = "rerun.datatypes.Mat3x3";
90
91 /// Returns the arrow data type this type corresponds to.
92 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
93
94 /// Serializes an array of `rerun::datatypes::Mat3x3` into an arrow array.
95 static Result<std::shared_ptr<arrow::Array>> to_arrow(
96 const datatypes::Mat3x3* instances, size_t num_instances
97 );
98
99 /// Fills an arrow array builder with an array of this type.
100 static rerun::Error fill_arrow_array_builder(
101 arrow::FixedSizeListBuilder* builder, const datatypes::Mat3x3* elements,
102 size_t num_elements
103 );
104 };
105} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:95
All built-in datatypes. See Types in the Rerun manual.
Definition rerun.hpp:83
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Datatype: A 3x3 Matrix.
Definition mat3x3.hpp:32
std::array< float, 9 > flat_columns
Flat list of matrix coefficients in column-major order.
Definition mat3x3.hpp:34
Mat3x3(const Vec3D(&columns)[3])
Creates a new 3x3 matrix from 3 columns of 3 elements each.
Definition mat3x3.hpp:41
Mat3x3(const float *elements)
Construct a new 3x3 matrix from a pointer to 9 floats (in column major order).
Definition mat3x3.hpp:55
Datatype: A vector in 3D space.
Definition vec3d.hpp:21