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