Rerun C++ SDK
Loading...
Searching...
No Matches
pinhole_projection.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/pinhole_projection.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**: Camera projection, from image coordinates to view coordinates.
15 ///
16 /// Child from parent.
17 /// Image coordinates from camera view coordinates.
18 ///
19 /// Example:
20 /// ```text
21 /// 1496.1 0.0 980.5
22 /// 0.0 1496.1 744.5
23 /// 0.0 0.0 1.0
24 /// ```
26 rerun::datatypes::Mat3x3 image_from_camera;
27
28 public: // START of extensions from pinhole_projection_ext.cpp:
29 /// Construct a new 3x3 pinhole matrix from a pointer to 9 floats (in column major order).
30 static PinholeProjection from_mat3x3(const float* elements) {
32 }
33
34 // END of extensions from pinhole_projection_ext.cpp, start of generated code:
35
36 public:
37 PinholeProjection() = default;
38
40 : image_from_camera(image_from_camera_) {}
41
42 PinholeProjection& operator=(rerun::datatypes::Mat3x3 image_from_camera_) {
43 image_from_camera = image_from_camera_;
44 return *this;
45 }
46
47 PinholeProjection(std::array<float, 9> flat_columns_) : image_from_camera(flat_columns_) {}
48
49 PinholeProjection& operator=(std::array<float, 9> flat_columns_) {
50 image_from_camera = flat_columns_;
51 return *this;
52 }
53
54 /// Cast to the underlying Mat3x3 datatype
55 operator rerun::datatypes::Mat3x3() const {
56 return image_from_camera;
57 }
58 };
59} // namespace rerun::components
60
61namespace rerun {
62 static_assert(sizeof(rerun::datatypes::Mat3x3) == sizeof(components::PinholeProjection));
63
64 /// \private
65 template <>
66 struct Loggable<components::PinholeProjection> {
67 static constexpr const char Name[] = "rerun.components.PinholeProjection";
68
69 /// Returns the arrow data type this type corresponds to.
70 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
71 return Loggable<rerun::datatypes::Mat3x3>::arrow_datatype();
72 }
73
74 /// Serializes an array of `rerun::components::PinholeProjection` into an arrow array.
75 static Result<std::shared_ptr<arrow::Array>> to_arrow(
76 const components::PinholeProjection* instances, size_t num_instances
77 ) {
78 if (num_instances == 0) {
79 return Loggable<rerun::datatypes::Mat3x3>::to_arrow(nullptr, 0);
80 } else if (instances == nullptr) {
81 return rerun::Error(
82 ErrorCode::UnexpectedNullArgument,
83 "Passed array instances is null when num_elements> 0."
84 );
85 } else {
86 return Loggable<rerun::datatypes::Mat3x3>::to_arrow(
87 &instances->image_from_camera,
88 num_instances
89 );
90 }
91 }
92 };
93} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:95
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:22
Component: Camera projection, from image coordinates to view coordinates.
Definition pinhole_projection.hpp:25
static PinholeProjection from_mat3x3(const float *elements)
Construct a new 3x3 pinhole matrix from a pointer to 9 floats (in column major order).
Definition pinhole_projection.hpp:30
Datatype: A 3x3 Matrix.
Definition mat3x3.hpp:31