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