Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose ui point radii to logging & blueprint, remove old default radius settings in favor of blueprint default components #6678

Merged
merged 30 commits into from
Jul 2, 2024
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
71baa1c
update radius doc & add python utility for ui points
Wumpf Jun 28, 2024
6f12c95
allow negative radius on radius processing
Wumpf Jun 28, 2024
58570d6
add python points3d snippet for ui radius
Wumpf Jun 28, 2024
6419126
wip: snippet placeholder for points2d ui radius
Wumpf Jun 28, 2024
82ba394
ui/scene unit aware radius ui
Wumpf Jun 28, 2024
68ff62e
improve radius docs, call it consistently ui points & scene units
Wumpf Jun 28, 2024
aa1f414
remove line/point default radius settings from 2d/3d views
Wumpf Jun 28, 2024
e0deb7d
remove auto size from re_renderer
Wumpf Jun 28, 2024
8fb3afa
Express some hardcoded default radii as Radius::default
Wumpf Jul 1, 2024
0e8936a
minor fix to compare_snippet_output
Wumpf Jul 1, 2024
ce83e0f
add rust version of point3d_ui_radius
Wumpf Jul 1, 2024
21aa36f
Add C++ point3d_ui_radius demo & C++ radius extensions
Wumpf Jul 1, 2024
0df4118
add example for ui radius & points2d
Wumpf Jul 1, 2024
5b8035a
Add snippet for strip3d with ui radius
Wumpf Jul 1, 2024
cd6f858
Add snippet for 2d line point radius
Wumpf Jul 1, 2024
5d21722
fix ignoring Result on new snippets
Wumpf Jul 1, 2024
776a153
fix C++ warning
Wumpf Jul 1, 2024
5f06955
add UI & GUI capitilization lint
Wumpf Jul 1, 2024
3f0a956
fix scaling typos
Wumpf Jul 1, 2024
8f65587
comment fix
Wumpf Jul 1, 2024
da6fe69
don't clamp radius_ui drag value so user can't put in negative numbers
Wumpf Jul 1, 2024
9a1860e
rename ONE_UI_POINTS to ONE_UI_POINT
Wumpf Jul 1, 2024
2b1ad43
remove Size::ONE
Wumpf Jul 1, 2024
948979e
rename box_radius to box_line_radius
Wumpf Jul 1, 2024
975439d
Remove Radius::ONE
Wumpf Jul 1, 2024
6ce81c2
treat -0.0 (and even negative NaN) as ui point, simplified assertions
Wumpf Jul 1, 2024
13c2e2b
remove unused next_offset
Wumpf Jul 1, 2024
79991c7
fix UI capitalization that got missed due to codegen
Wumpf Jul 1, 2024
9f729cf
add tests & comments for point/scene distinction
Wumpf Jul 2, 2024
9f5d8c5
fix point2d_ui_radius comparison test, rename entities to be more sen…
Wumpf Jul 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add example for ui radius & points2d
  • Loading branch information
Wumpf committed Jul 1, 2024
commit 0df41180839f4310a6d5cae2aaab14b048e06d12
1 change: 1 addition & 0 deletions crates/re_types/definitions/rerun/archetypes/points2d.fbs
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ namespace rerun.archetypes;
///
/// \example archetypes/point2d_simple !api title="Simple 2D points" image="https://static.rerun.io/point2d_simple/a8e801958bce5aa4e080659c033630f86ce95f71/1200w.png"
/// \example archetypes/point2d_random title="Randomly distributed 2D points with varying color and radius" image="https://static.rerun.io/point2d_random/8e8ac75373677bd72bd3f56a15e44fcab309a168/1200w.png"
/// \example archetypes/point2d_ui_radius title="Log points with radii given in ui points" image="https://static.rerun.io/point2d_ui_radius/ce804fc77300d89c348b4ab5960395171497b7ac/1200w.png"
table Points2D (
"attr.rust.derive": "PartialEq",
"attr.docs.category": "Spatial 2D",
45 changes: 44 additions & 1 deletion crates/re_types/src/archetypes/points2d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions docs/content/reference/types/archetypes/points2d.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions docs/snippets/all/archetypes/point2d_ui_radius.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Log some points with ui points & scene unit radii.

#include <rerun.hpp>

int main() {
const auto rec = rerun::RecordingStream("rerun_example_points2d_ui_radius");
rec.spawn().exit_on_failure();

// Two blue points with scene unit radii of 0.1 and 0.3.
rec.log(
"scene_unit_points",
rerun::Points2D({{0.0f, 0.0f}, {0.0f, 1.0f}})
// By default, radii are interpreted as world-space units.
.with_radii({0.1f, 0.3f})
.with_colors(rerun::Color(0, 0, 255))
);

// Two red points with ui point radii of 40 and 60.
// Ui points are independent of zooming in Views, but are sensitive to the application ui scaling.
// For 100% ui scaling, ui points are equal to pixels.
rec.log(
"ui_points_points",
rerun::Points2D({{0.0f, 0.0f}, {1.0f, 1.0f}})
// rerun::Radius::ui_points produces radii that the viewer interprets as given in ui points.
.with_radii({
rerun::Radius::ui_points(40.0f),
rerun::Radius::ui_points(60.0f),
})
.with_colors(rerun::Color(255, 0, 0))
);

// TODO(#5521): log VisualBounds2D
}
33 changes: 33 additions & 0 deletions docs/snippets/all/archetypes/point2d_ui_radius.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Log some points with ui points & scene unit radii."""

import rerun as rr
import rerun.blueprint as rrb

rr.init("rerun_example_points2d_ui_radius", spawn=True)

# Two blue points with scene unit radii of 0.1 and 0.3.
rr.log(
"scene_unit_points",
rr.Points2D(
[[0, 0], [0, 1]],
# By default, radii are interpreted as world-space units.
radii=[0.1, 0.3],
colors=[0, 0, 255],
),
)

# Two red points with ui point radii of 40 and 60.
# Ui points are independent of zooming in Views, but are sensitive to the application ui scaling.
# For 100% ui scaling, ui points are equal to pixels.
rr.log(
"ui_points_points",
rr.Points2D(
[[1, 0], [1, 1]],
# rr.Radius.ui_points produces radii that the viewer interprets as given in ui points.
radii=rr.Radius.ui_points([40.0, 60.0]),
colors=[255, 0, 0],
),
)

# Set view bounds:
rr.send_blueprint(rrb.Spatial2DView(visual_bounds=rrb.VisualBounds2D(x_range=[-1, 2], y_range=[-1, 2])))
32 changes: 32 additions & 0 deletions docs/snippets/all/archetypes/point2d_ui_radius.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//! Log some points with ui points & scene unit radii.

fn main() -> Result<(), Box<dyn std::error::Error>> {
let rec = rerun::RecordingStreamBuilder::new("rerun_example_points2d_ui_radius").spawn()?;

// Two blue points with scene unit radii of 0.1 and 0.3.
rec.log(
"scene_unit_points",
&rerun::Points2D::new([(0.0, 0.0), (0.0, 1.0)])
// By default, radii are interpreted as world-space units.
.with_radii([0.1, 0.3])
.with_colors([rerun::Color::from_rgb(0, 0, 255)]),
);

// Two red points with ui point radii of 40 and 60.
// Ui points are independent of zooming in Views, but are sensitive to the application ui scaling.
// For 100% ui scaling, ui points are equal to pixels.
rec.log(
"ui_points_points",
&rerun::Points2D::new([(1.0, 0.0), (1.0, 1.0)])
// rerun::Radius::new_ui_points produces a radius that the viewer interprets as given in ui points.
.with_radii([
rerun::Radius::new_ui_points(40.0),
rerun::Radius::new_ui_points(60.0),
])
.with_colors([rerun::Color::from_rgb(255, 0, 0)]),
);

// TODO(#5521): log VisualBounds2D

Ok(())
}
2 changes: 1 addition & 1 deletion docs/snippets/all/archetypes/point3d_ui_radius.cpp
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ int main() {
// For 100% ui scaling, ui points are equal to pixels.
rec.log(
"ui_points_points",
rerun::Points3D({{0.0f, 0.0f, 0.0}, {1.0f, 0.0f, 1.0f}})
rerun::Points3D({{0.0f, 0.0f, 0.0f}, {1.0f, 0.0f, 1.0f}})
// rerun::Radius::ui_points produces radii that the viewer interprets as given in ui points.
.with_radii({
rerun::Radius::ui_points(40.0f),
39 changes: 38 additions & 1 deletion rerun_cpp/src/rerun/archetypes/points2d.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions rerun_cpp/src/rerun/archetypes/points3d.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 46 additions & 2 deletions rerun_py/rerun_sdk/rerun/archetypes/points2d.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.