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