Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::archetypes::Points3D Struct Reference

Archetype: A 3D point cloud with positions and optional colors, radii, labels, etc. More...

#include <rerun/archetypes/points3d.hpp>

Public Types

using IndicatorComponent = rerun::components::IndicatorComponent< IndicatorComponentName >
 Indicator component, used to identify the archetype when converting to a list of components.
 

Public Member Functions

 Points3D (Points3D &&other)=default
 
 Points3D (const Points3D &other)=default
 
Points3Doperator= (const Points3D &other)=default
 
Points3Doperator= (Points3D &&other)=default
 
 Points3D (Collection< rerun::components::Position3D > _positions)
 
Points3D with_positions (const Collection< rerun::components::Position3D > &_positions) &&
 All the 3D positions at which the point cloud shows points.
 
Points3D with_radii (const Collection< rerun::components::Radius > &_radii) &&
 Optional radii for the points, effectively turning them into circles.
 
Points3D with_colors (const Collection< rerun::components::Color > &_colors) &&
 Optional colors for the points.
 
Points3D with_labels (const Collection< rerun::components::Text > &_labels) &&
 Optional text labels for the points.
 
Points3D with_show_labels (const rerun::components::ShowLabels &_show_labels) &&
 Optional choice of whether the text labels should be shown by default.
 
Points3D with_many_show_labels (const Collection< rerun::components::ShowLabels > &_show_labels) &&
 This method makes it possible to pack multiple show_labels in a single component batch.
 
Points3D with_class_ids (const Collection< rerun::components::ClassId > &_class_ids) &&
 Optional class Ids for the points.
 
Points3D with_keypoint_ids (const Collection< rerun::components::KeypointId > &_keypoint_ids) &&
 Optional keypoint IDs for the points, identifying them within a class.
 
Collection< ComponentColumncolumns (const Collection< uint32_t > &lengths_)
 Partitions the component data into multiple sub-batches.
 
Collection< ComponentColumncolumns ()
 Partitions the component data into unit-length sub-batches.
 

Static Public Member Functions

static Points3D update_fields ()
 Update only some specific fields of a Points3D.
 
static Points3D clear_fields ()
 Clear all the fields of a Points3D.
 

Public Attributes

std::optional< ComponentBatchpositions
 All the 3D positions at which the point cloud shows points.
 
std::optional< ComponentBatchradii
 Optional radii for the points, effectively turning them into circles.
 
std::optional< ComponentBatchcolors
 Optional colors for the points.
 
std::optional< ComponentBatchlabels
 Optional text labels for the points.
 
std::optional< ComponentBatchshow_labels
 Optional choice of whether the text labels should be shown by default.
 
std::optional< ComponentBatchclass_ids
 Optional class Ids for the points.
 
std::optional< ComponentBatchkeypoint_ids
 Optional keypoint IDs for the points, identifying them within a class.
 

Static Public Attributes

static constexpr const char IndicatorComponentName [] = "rerun.components.Points3DIndicator"
 
static constexpr const char ArchetypeName [] = "rerun.archetypes.Points3D"
 The name of the archetype as used in ComponentDescriptors.
 
static constexpr auto Descriptor_positions
 ComponentDescriptor for the positions field.
 
static constexpr auto Descriptor_radii
 ComponentDescriptor for the radii field.
 
static constexpr auto Descriptor_colors
 ComponentDescriptor for the colors field.
 
static constexpr auto Descriptor_labels
 ComponentDescriptor for the labels field.
 
static constexpr auto Descriptor_show_labels
 ComponentDescriptor for the show_labels field.
 
static constexpr auto Descriptor_class_ids
 ComponentDescriptor for the class_ids field.
 
static constexpr auto Descriptor_keypoint_ids
 ComponentDescriptor for the keypoint_ids field.
 

Detailed Description

Archetype: A 3D point cloud with positions and optional colors, radii, labels, etc.

Examples

Simple 3D points

image

#include <rerun.hpp>
int main() {
const auto rec = rerun::RecordingStream("rerun_example_points3d");
rec.spawn().exit_on_failure();
rec.log("points", rerun::Points3D({{0.0f, 0.0f, 0.0f}, {1.0f, 1.0f, 1.0f}}));
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:60
Archetype: A 3D point cloud with positions and optional colors, radii, labels, etc.
Definition points3d.hpp:175

Update a point cloud over time

image

#include <rerun.hpp>
#include <algorithm>
#include <vector>
int main() {
const auto rec = rerun::RecordingStream("rerun_example_points3d_row_updates");
rec.spawn().exit_on_failure();
// Prepare a point cloud that evolves over 5 timesteps, changing the number of points in the process.
std::vector<std::array<float, 3>> positions[] = {
// clang-format off
{{1.0, 0.0, 1.0}, {0.5, 0.5, 2.0}},
{{1.5, -0.5, 1.5}, {1.0, 1.0, 2.5}, {-0.5, 1.5, 1.0}, {-1.5, 0.0, 2.0}},
{{2.0, 0.0, 2.0}, {1.5, -1.5, 3.0}, {0.0, -2.0, 2.5}, {1.0, -1.0, 3.5}},
{{-2.0, 0.0, 2.0}, {-1.5, 1.5, 3.0}, {-1.0, 1.0, 3.5}},
{{1.0, -1.0, 1.0}, {2.0, -2.0, 2.0}, {3.0, -1.0, 3.0}, {2.0, 0.0, 4.0}},
// clang-format on
};
// At each timestep, all points in the cloud share the same but changing color and radius.
std::vector<uint32_t> colors = {0xFF0000FF, 0x00FF00FF, 0x0000FFFF, 0xFFFF00FF, 0x00FFFFFF};
std::vector<float> radii = {0.05f, 0.01f, 0.2f, 0.1f, 0.3f};
for (size_t i = 0; i <5; i++) {
rec.set_time_seconds("time", 10.0 + static_cast<double>(i));
rec.log(
"points",
);
}
}
std::optional< ComponentBatch > positions
All the 3D positions at which the point cloud shows points.
Definition points3d.hpp:177
Points3D with_radii(const Collection< rerun::components::Radius > &_radii) &&
Optional radii for the points, effectively turning them into circles.
Definition points3d.hpp:277
std::optional< ComponentBatch > radii
Optional radii for the points, effectively turning them into circles.
Definition points3d.hpp:180
Points3D with_colors(const Collection< rerun::components::Color > &_colors) &&
Optional colors for the points.
Definition points3d.hpp:283
std::optional< ComponentBatch > colors
Optional colors for the points.
Definition points3d.hpp:183

Update a point cloud over time, in a single operation

image

#include <array>
#include <rerun.hpp>
#include <vector>
using namespace std::chrono_literals;
int main() {
const auto rec = rerun::RecordingStream("rerun_example_points3d_column_updates");
rec.spawn().exit_on_failure();
// Prepare a point cloud that evolves over 5 timesteps, changing the number of points in the process.
std::vector<std::array<float, 3>> positions = {
// clang-format off
{1.0, 0.0, 1.0}, {0.5, 0.5, 2.0},
{1.5, -0.5, 1.5}, {1.0, 1.0, 2.5}, {-0.5, 1.5, 1.0}, {-1.5, 0.0, 2.0},
{2.0, 0.0, 2.0}, {1.5, -1.5, 3.0}, {0.0, -2.0, 2.5}, {1.0, -1.0, 3.5},
{-2.0, 0.0, 2.0}, {-1.5, 1.5, 3.0}, {-1.0, 1.0, 3.5},
{1.0, -1.0, 1.0}, {2.0, -2.0, 2.0}, {3.0, -1.0, 3.0}, {2.0, 0.0, 4.0},
// clang-format on
};
// At each timestep, all points in the cloud share the same but changing color and radius.
std::vector<uint32_t> colors = {0xFF0000FF, 0x00FF00FF, 0x0000FFFF, 0xFFFF00FF, 0x00FFFFFF};
std::vector<float> radii = {0.05f, 0.01f, 0.2f, 0.1f, 0.3f};
// Log at seconds 10-14
auto times = rerun::Collection{10s, 11s, 12s, 13s, 14s};
auto time_column = rerun::TimeColumn::from_times("time", std::move(times));
// Partition our data as expected across the 5 timesteps.
auto position = rerun::Points3D().with_positions(positions).columns({2, 4, 4, 3, 4});
auto color_and_radius = rerun::Points3D().with_colors(colors).with_radii(radii).columns();
rec.send_columns("points", time_column, position, color_and_radius);
}
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
static TimeColumn from_times(std::string timeline_name, const Collection< std::chrono::duration< TRep, TPeriod > > &chrono_times, SortingStatus sorting_status=SortingStatus::Unknown)
Creates a time column from an array of arbitrary std::chrono durations.
Definition time_column.hpp:135
Points3D with_positions(const Collection< rerun::components::Position3D > &_positions) &&
All the 3D positions at which the point cloud shows points.
Definition points3d.hpp:270
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.

Update specific properties of a point cloud over time

image

#include <rerun.hpp>
#include <algorithm>
#include <vector>
int main() {
const auto rec = rerun::RecordingStream("rerun_example_points3d_partial_updates");
rec.spawn().exit_on_failure();
std::vector<rerun::Position3D> positions;
for (int i = 0; i <10; ++i) {
positions.emplace_back(static_cast<float>(i), 0.0f, 0.0f);
}
rec.set_time_sequence("frame", 0);
rec.log("points", rerun::Points3D(positions));
for (int i = 0; i <10; ++i) {
std::vector<rerun::Color> colors;
for (int n = 0; n <10; ++n) {
if (n <i) {
colors.emplace_back(rerun::Color(20, 200, 20));
} else {
colors.emplace_back(rerun::Color(200, 20, 20));
}
}
std::vector<rerun::Radius> radii;
for (int n = 0; n <10; ++n) {
if (n <i) {
radii.emplace_back(rerun::Radius(0.6f));
} else {
radii.emplace_back(rerun::Radius(0.2f));
}
}
// Update only the colors and radii, leaving everything else as-is.
rec.set_time_sequence("frame", i);
rec.log("points", rerun::Points3D::update_fields().with_radii(radii).with_colors(colors));
}
std::vector<rerun::Radius> radii;
radii.emplace_back(0.3f);
// Update the positions and radii, and clear everything else in the process.
rec.set_time_sequence("frame", 20);
rec.log("points", rerun::Points3D::clear_fields().with_positions(positions).with_radii(radii));
}
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:18
Component: The radius of something, e.g.
Definition radius.hpp:22

Member Function Documentation

◆ with_labels()

Points3D rerun::archetypes::Points3D::with_labels ( const Collection< rerun::components::Text > &  _labels) &&
inline

Optional text labels for the points.

If there's a single label present, it will be placed at the center of the entity. Otherwise, each instance will have its own label.

◆ with_many_show_labels()

Points3D rerun::archetypes::Points3D::with_many_show_labels ( const Collection< rerun::components::ShowLabels > &  _show_labels) &&
inline

This method makes it possible to pack multiple show_labels in a single component batch.

This only makes sense when used in conjunction with columns. with_show_labels should be used when logging a single row's worth of data.

◆ with_class_ids()

Points3D rerun::archetypes::Points3D::with_class_ids ( const Collection< rerun::components::ClassId > &  _class_ids) &&
inline

Optional class Ids for the points.

The components::ClassId provides colors and labels if not specified explicitly.

◆ with_keypoint_ids()

Points3D rerun::archetypes::Points3D::with_keypoint_ids ( const Collection< rerun::components::KeypointId > &  _keypoint_ids) &&
inline

Optional keypoint IDs for the points, identifying them within a class.

If keypoint IDs are passed in but no components::ClassIds were specified, the components::ClassId will default to 0. This is useful to identify points within a single classification (which is identified with class_id). E.g. the classification might be 'Person' and the keypoints refer to joints on a detected skeleton.

◆ columns() [1/2]

Collection< ComponentColumn > rerun::archetypes::Points3D::columns ( const Collection< uint32_t > &  lengths_)

Partitions the component data into multiple sub-batches.

Specifically, this transforms the existing ComponentBatch data into ComponentColumns instead, via ComponentBatch::partitioned.

This makes it possible to use RecordingStream::send_columns to send columnar data directly into Rerun.

The specified lengths must sum to the total length of the component batch.

◆ columns() [2/2]

Collection< ComponentColumn > rerun::archetypes::Points3D::columns ( )

Partitions the component data into unit-length sub-batches.

This is semantically similar to calling columns with std::vector<uint32_t>(n, 1), where n is automatically guessed.

Member Data Documentation

◆ labels

std::optional<ComponentBatch> rerun::archetypes::Points3D::labels

Optional text labels for the points.

If there's a single label present, it will be placed at the center of the entity. Otherwise, each instance will have its own label.

◆ class_ids

std::optional<ComponentBatch> rerun::archetypes::Points3D::class_ids

Optional class Ids for the points.

The components::ClassId provides colors and labels if not specified explicitly.

◆ keypoint_ids

std::optional<ComponentBatch> rerun::archetypes::Points3D::keypoint_ids

Optional keypoint IDs for the points, identifying them within a class.

If keypoint IDs are passed in but no components::ClassIds were specified, the components::ClassId will default to 0. This is useful to identify points within a single classification (which is identified with class_id). E.g. the classification might be 'Person' and the keypoints refer to joints on a detected skeleton.

◆ Descriptor_positions

constexpr auto rerun::archetypes::Points3D::Descriptor_positions
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "positions",
Loggable<rerun::components::Position3D>::Descriptor.component_name
)
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition points3d.hpp:215

ComponentDescriptor for the positions field.

◆ Descriptor_radii

constexpr auto rerun::archetypes::Points3D::Descriptor_radii
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "radii", Loggable<rerun::components::Radius>::Descriptor.component_name
)

ComponentDescriptor for the radii field.

◆ Descriptor_colors

constexpr auto rerun::archetypes::Points3D::Descriptor_colors
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "colors", Loggable<rerun::components::Color>::Descriptor.component_name
)

ComponentDescriptor for the colors field.

◆ Descriptor_labels

constexpr auto rerun::archetypes::Points3D::Descriptor_labels
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "labels", Loggable<rerun::components::Text>::Descriptor.component_name
)

ComponentDescriptor for the labels field.

◆ Descriptor_show_labels

constexpr auto rerun::archetypes::Points3D::Descriptor_show_labels
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "show_labels",
Loggable<rerun::components::ShowLabels>::Descriptor.component_name
)

ComponentDescriptor for the show_labels field.

◆ Descriptor_class_ids

constexpr auto rerun::archetypes::Points3D::Descriptor_class_ids
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "class_ids",
Loggable<rerun::components::ClassId>::Descriptor.component_name
)

ComponentDescriptor for the class_ids field.

◆ Descriptor_keypoint_ids

constexpr auto rerun::archetypes::Points3D::Descriptor_keypoint_ids
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "keypoint_ids",
Loggable<rerun::components::KeypointId>::Descriptor.component_name
)

ComponentDescriptor for the keypoint_ids field.


The documentation for this struct was generated from the following file: