6#include "../collection.hpp"
7#include "../component_batch.hpp"
8#include "../component_column.hpp"
9#include "../components/color.hpp"
10#include "../components/image_plane_distance.hpp"
11#include "../components/pinhole_projection.hpp"
12#include "../components/radius.hpp"
13#include "../components/resolution.hpp"
14#include "../components/transform_frame_id.hpp"
15#include "../components/view_coordinates.hpp"
16#include "../result.hpp"
166 std::optional<ComponentBatch>
color;
242 const float EPSILON = std::numeric_limits<float>::epsilon();
244 const float focal_length_y = 0.5f / std::tan(std::max<float>(fov_y * 0.5f, EPSILON));
246 {focal_length_y, focal_length_y},
278 .value_or_throw()) {}
297 return std::move(*
this);
310 return std::move(*
this);
326 return std::move(*
this);
337 return std::move(*
this);
370 return std::move(*
this);
382 return std::move(*
this);
400 return std::move(*
this);
412 return std::move(*
this);
426 return std::move(*
this);
438 return std::move(*
this);
448 _image_plane_distance,
452 return std::move(*
this);
463 _image_plane_distance,
467 return std::move(*
this);
473 return std::move(*
this);
482 return std::move(*
this);
489 return std::move(*
this);
499 return std::move(*
this);
523 template <
typename T>
528 struct AsComponents<archetypes::
Pinhole> {
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
A class for representing either a usable value, or an error.
Definition result.hpp:14
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:76
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Arrow-encoded data of a single batch of components together with a component descriptor.
Definition component_batch.hpp:28
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:16
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Archetype: Camera perspective projection (a.k.a.
Definition pinhole.hpp:89
Pinhole with_many_child_frame(const Collection< rerun::components::TransformFrameId > &_child_frame) &&
This method makes it possible to pack multiple child_frame in a single component batch.
Definition pinhole.hpp:407
Pinhole with_resolution(const rerun::components::Resolution &_resolution) &&
Pixel resolution (usually integers) of child image space.
Definition pinhole.hpp:323
Pinhole with_parent_frame(const rerun::components::TransformFrameId &_parent_frame) &&
The parent frame this transform transforms into.
Definition pinhole.hpp:423
Pinhole with_many_color(const Collection< rerun::components::Color > &_color) &&
This method makes it possible to pack multiple color in a single component batch.
Definition pinhole.hpp:480
std::optional< ComponentBatch > color
Color of the camera wireframe.
Definition pinhole.hpp:166
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition pinhole.hpp:173
Pinhole with_resolution(float width, float height) &&
Pixel resolution (usually integers) of child image space.
Definition pinhole.hpp:254
static constexpr auto Descriptor_color
ComponentDescriptor for the color field.
Definition pinhole.hpp:206
static constexpr auto Descriptor_resolution
ComponentDescriptor for the resolution field.
Definition pinhole.hpp:181
std::optional< ComponentBatch > image_from_camera
Camera projection, from image coordinates to view coordinates.
Definition pinhole.hpp:93
Pinhole with_resolution(int width, int height) &&
Pixel resolution (usually integers) of child image space.
Definition pinhole.hpp:261
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Pinhole with_camera_xyz(const rerun::components::ViewCoordinates &_camera_xyz) &&
Sets the view coordinates for the camera.
Definition pinhole.hpp:367
Pinhole with_many_image_plane_distance(const Collection< rerun::components::ImagePlaneDistance > &_image_plane_distance) &&
This method makes it possible to pack multiple image_plane_distance in a single component batch.
Definition pinhole.hpp:459
std::optional< ComponentBatch > line_width
Width of the camera wireframe lines.
Definition pinhole.hpp:169
Pinhole with_child_frame(const rerun::components::TransformFrameId &_child_frame) &&
The child frame this transform transforms from.
Definition pinhole.hpp:397
Pinhole with_many_camera_xyz(const Collection< rerun::components::ViewCoordinates > &_camera_xyz) &&
This method makes it possible to pack multiple camera_xyz in a single component batch.
Definition pinhole.hpp:377
static Pinhole update_fields()
Update only some specific fields of a Pinhole.
Definition pinhole.hpp:281
std::optional< ComponentBatch > image_plane_distance
The distance from the camera origin to the image plane when the projection is shown in a 3D viewer.
Definition pinhole.hpp:163
Pinhole with_color(const rerun::components::Color &_color) &&
Color of the camera wireframe.
Definition pinhole.hpp:471
static constexpr auto Descriptor_camera_xyz
ComponentDescriptor for the camera_xyz field.
Definition pinhole.hpp:186
static Pinhole from_fov_and_aspect_ratio(float fov_y, float aspect_ratio)
Creates a pinhole from the camera vertical field of view (in radians) and aspect ratio (width/height)...
Definition pinhole.hpp:241
static Pinhole clear_fields()
Clear all the fields of a Pinhole.
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
static constexpr auto Descriptor_image_plane_distance
ComponentDescriptor for the image_plane_distance field.
Definition pinhole.hpp:201
Pinhole with_many_parent_frame(const Collection< rerun::components::TransformFrameId > &_parent_frame) &&
This method makes it possible to pack multiple parent_frame in a single component batch.
Definition pinhole.hpp:433
static Pinhole from_focal_length_and_resolution(const datatypes::Vec2D &focal_length, const datatypes::Vec2D &resolution)
Creates a pinhole from the camera focal length and resolution, both specified in pixels.
std::optional< ComponentBatch > parent_frame
The parent frame this transform transforms into.
Definition pinhole.hpp:158
static constexpr auto Descriptor_parent_frame
ComponentDescriptor for the parent_frame field.
Definition pinhole.hpp:196
std::optional< ComponentBatch > camera_xyz
Sets the view coordinates for the camera.
Definition pinhole.hpp:134
static Pinhole from_focal_length_and_resolution(float focal_length, const datatypes::Vec2D &resolution)
Creates a symmetric pinhole from the camera focal length and resolution, both specified in pixels.
Definition pinhole.hpp:232
std::optional< ComponentBatch > child_frame
The child frame this transform transforms from.
Definition pinhole.hpp:148
static constexpr auto Descriptor_line_width
ComponentDescriptor for the line_width field.
Definition pinhole.hpp:210
Pinhole with_many_line_width(const Collection< rerun::components::Radius > &_line_width) &&
This method makes it possible to pack multiple line_width in a single component batch.
Definition pinhole.hpp:496
std::optional< ComponentBatch > resolution
Pixel resolution (usually integers) of child image space.
Definition pinhole.hpp:105
Pinhole with_line_width(const rerun::components::Radius &_line_width) &&
Width of the camera wireframe lines.
Definition pinhole.hpp:486
Pinhole with_many_image_from_camera(const Collection< rerun::components::PinholeProjection > &_image_from_camera) &&
This method makes it possible to pack multiple image_from_camera in a single component batch.
Definition pinhole.hpp:304
Pinhole with_image_from_camera(const rerun::components::PinholeProjection &_image_from_camera) &&
Camera projection, from image coordinates to view coordinates.
Definition pinhole.hpp:291
Pinhole with_many_resolution(const Collection< rerun::components::Resolution > &_resolution) &&
This method makes it possible to pack multiple resolution in a single component batch.
Definition pinhole.hpp:333
Pinhole with_image_plane_distance(const rerun::components::ImagePlaneDistance &_image_plane_distance) &&
The distance from the camera origin to the image plane when the projection is shown in a 3D viewer.
Definition pinhole.hpp:444
static constexpr auto Descriptor_image_from_camera
ComponentDescriptor for the image_from_camera field.
Definition pinhole.hpp:176
static constexpr auto Descriptor_child_frame
ComponentDescriptor for the child_frame field.
Definition pinhole.hpp:191
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:17
Component: The distance from the camera origin to the image plane when the projection is shown in a 3...
Definition image_plane_distance.hpp:16
Component: Camera projection, from image coordinates to view coordinates.
Definition pinhole_projection.hpp:25
Component: The radius of something, e.g.
Definition radius.hpp:21
Component: Pixel resolution width & height, e.g.
Definition resolution.hpp:18
Component: How we interpret the coordinate system of an entity/space.
Definition view_coordinates.hpp:35
Datatype: A vector in 2D space.
Definition vec2d.hpp:20