Rerun C++ SDK
Loading...
Searching...
No Matches
plane3d.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/plane3d.fbs".
3
4#pragma once
5
6#include "../component_descriptor.hpp"
7#include "../datatypes/plane3d.hpp"
8#include "../result.hpp"
9
10#include <cstdint>
11#include <memory>
12
13namespace rerun::components {
14 /// **Component**: An infinite 3D plane represented by a unit normal vector and a distance.
15 ///
16 /// Any point P on the plane fulfills the equation `dot(xyz, P) - d = 0`,
17 /// where `xyz` is the plane's normal and `d` the distance of the plane from the origin.
18 /// This representation is also known as the Hesse normal form.
19 ///
20 /// Note: although the normal will be passed through to the
21 /// datastore as provided, when used in the Viewer, planes will always be normalized.
22 /// I.e. the plane with xyz = (2, 0, 0), d = 1 is equivalent to xyz = (1, 0, 0), d = 0.5
23 struct Plane3D {
25
26 public:
27 Plane3D() = default;
28
29 Plane3D(rerun::datatypes::Plane3D xyzd_) : xyzd(xyzd_) {}
30
31 Plane3D& operator=(rerun::datatypes::Plane3D xyzd_) {
32 xyzd = xyzd_;
33 return *this;
34 }
35
36 /// Cast to the underlying Plane3D datatype
37 operator rerun::datatypes::Plane3D() const {
38 return xyzd;
39 }
40 };
41} // namespace rerun::components
42
43namespace rerun {
44 static_assert(sizeof(rerun::datatypes::Plane3D) == sizeof(components::Plane3D));
45
46 /// \private
47 template <>
48 struct Loggable<components::Plane3D> {
49 static constexpr ComponentDescriptor Descriptor = "rerun.components.Plane3D";
50
51 /// Returns the arrow data type this type corresponds to.
52 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
53 return Loggable<rerun::datatypes::Plane3D>::arrow_datatype();
54 }
55
56 /// Serializes an array of `rerun::components::Plane3D` into an arrow array.
57 static Result<std::shared_ptr<arrow::Array>> to_arrow(
58 const components::Plane3D* instances, size_t num_instances
59 ) {
60 if (num_instances == 0) {
61 return Loggable<rerun::datatypes::Plane3D>::to_arrow(nullptr, 0);
62 } else if (instances == nullptr) {
63 return rerun::Error(
64 ErrorCode::UnexpectedNullArgument,
65 "Passed array instances is null when num_elements> 0."
66 );
67 } else {
68 return Loggable<rerun::datatypes::Plane3D>::to_arrow(
69 &instances->xyzd,
70 num_instances
71 );
72 }
73 }
74 };
75} // 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: An infinite 3D plane represented by a unit normal vector and a distance.
Definition plane3d.hpp:23
Datatype: An infinite 3D plane represented by a unit normal vector and a distance.
Definition plane3d.hpp:29