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