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

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

#include <rerun/archetypes/points2d.hpp>

Public Types

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

Public Member Functions

 Points2D (Points2D &&other)=default
 
 Points2D (Collection< rerun::components::Position2D > _positions)
 
Points2D with_radii (Collection< rerun::components::Radius > _radii) &&
 Optional radii for the points, effectively turning them into circles.
 
Points2D with_colors (Collection< rerun::components::Color > _colors) &&
 Optional colors for the points.
 
Points2D with_labels (Collection< rerun::components::Text > _labels) &&
 Optional text labels for the points.
 
Points2D with_draw_order (rerun::components::DrawOrder _draw_order) &&
 An optional floating point value that specifies the 2D drawing order.
 
Points2D with_class_ids (Collection< rerun::components::ClassId > _class_ids) &&
 Optional class Ids for the points.
 
Points2D with_keypoint_ids (Collection< rerun::components::KeypointId > _keypoint_ids) &&
 Optional keypoint IDs for the points, identifying them within a class.
 
Points2D with_instance_keys (Collection< rerun::components::InstanceKey > _instance_keys) &&
 Unique identifiers for each individual point in the batch.
 
size_t num_instances () const
 Returns the number of primary instances of this archetype.
 

Public Attributes

Collection< rerun::components::Position2Dpositions
 All the 2D positions at which the point cloud shows points.
 
std::optional< Collection< rerun::components::Radius > > radii
 Optional radii for the points, effectively turning them into circles.
 
std::optional< Collection< rerun::components::Color > > colors
 Optional colors for the points.
 
std::optional< Collection< rerun::components::Text > > labels
 Optional text labels for the points.
 
std::optional< rerun::components::DrawOrderdraw_order
 An optional floating point value that specifies the 2D drawing order.
 
std::optional< Collection< rerun::components::ClassId > > class_ids
 Optional class Ids for the points.
 
std::optional< Collection< rerun::components::KeypointId > > keypoint_ids
 Optional keypoint IDs for the points, identifying them within a class.
 
std::optional< Collection< rerun::components::InstanceKey > > instance_keys
 Unique identifiers for each individual point in the batch.
 

Static Public Attributes

static constexpr const char IndicatorComponentName [] = "rerun.components.Points2DIndicator"
 

Detailed Description

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

Example

Randomly distributed 2D points with varying color and radius

image

#include <rerun.hpp>
#include <algorithm>
#include <random>
#include <vector>
int main() {
const auto rec = rerun::RecordingStream("rerun_example_points2d_simple");
rec.spawn().exit_on_failure();
std::default_random_engine gen;
std::uniform_real_distribution<float> dist_pos(-5.0f, 5.0f);
std::uniform_real_distribution<float> dist_radius(0.1f, 1.0f);
// On MSVC uint8_t distributions are not supported.
std::uniform_int_distribution<int> dist_color(0, 255);
std::vector<rerun::Position2D> points2d(10);
std::generate(points2d.begin(), points2d.end(), [&] {
return rerun::Position2D(dist_pos(gen), dist_pos(gen));
});
std::vector<rerun::Color> colors(10);
std::generate(colors.begin(), colors.end(), [&] {
return rerun::Color(
static_cast<uint8_t>(dist_color(gen)),
static_cast<uint8_t>(dist_color(gen)),
static_cast<uint8_t>(dist_color(gen))
);
});
std::vector<rerun::Radius> radii(10);
std::generate(radii.begin(), radii.end(), [&] { return dist_radius(gen); });
rec.log("random", rerun::Points2D(points2d).with_colors(colors).with_radii(radii));
// Log an extra rect to set the view bounds
rec.log("bounds", rerun::Boxes2D::from_half_sizes({{2.0f, 1.5f}}));
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:57
Archetype: A 2D point cloud with positions and optional colors, radii, labels, etc.
Definition points2d.hpp:71
std::optional< Collection< rerun::components::Radius > > radii
Optional radii for the points, effectively turning them into circles.
Definition points2d.hpp:76
std::optional< Collection< rerun::components::Color > > colors
Optional colors for the points.
Definition points2d.hpp:79
Points2D with_radii(Collection< rerun::components::Radius > _radii) &&
Optional radii for the points, effectively turning them into circles.
Definition points2d.hpp:121
Points2D with_colors(Collection< rerun::components::Color > _colors) &&
Optional colors for the points.
Definition points2d.hpp:128

Member Function Documentation

◆ with_draw_order()

Points2D rerun::archetypes::Points2D::with_draw_order ( rerun::components::DrawOrder  _draw_order) &&
inline

An optional floating point value that specifies the 2D drawing order.

Objects with higher values are drawn on top of those with lower values.

◆ with_class_ids()

Points2D rerun::archetypes::Points2D::with_class_ids ( Collection< rerun::components::ClassId _class_ids) &&
inline

Optional class Ids for the points.

The class ID provides colors and labels if not specified explicitly.

◆ with_keypoint_ids()

Points2D rerun::archetypes::Points2D::with_keypoint_ids ( 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 class IDs were specified, the class ID 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.

Member Data Documentation

◆ draw_order

std::optional<rerun::components::DrawOrder> rerun::archetypes::Points2D::draw_order

An optional floating point value that specifies the 2D drawing order.

Objects with higher values are drawn on top of those with lower values.

◆ class_ids

std::optional<Collection<rerun::components::ClassId> > rerun::archetypes::Points2D::class_ids

Optional class Ids for the points.

The class ID provides colors and labels if not specified explicitly.

◆ keypoint_ids

std::optional<Collection<rerun::components::KeypointId> > rerun::archetypes::Points2D::keypoint_ids

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

If keypoint IDs are passed in but no class IDs were specified, the class ID 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.


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