-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add rust version of point3d_ui_radius
- Loading branch information
Showing
2 changed files
with
29 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,30 @@ | ||
//! Log some very simple points. | ||
//! Log some points with ui points & scene unit radii. | ||
fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
let rec = rerun::RecordingStreamBuilder::new("rerun_example_points3d_ui_radius").spawn()?; | ||
|
||
// Two blue points with scene unit radii of 0.1 and 0.3. | ||
rec.log( | ||
"points", | ||
&rerun::Points3D::new([(0.0, 0.0, 0.0), (1.0, 1.0, 1.0)]), | ||
)?; | ||
"scene_unit_points", | ||
&rerun::Points3D::new([(0.0, 1.0, 0.0), (1.0, 1.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::Points3D::new([(0.0, 0.0, 0.0), (1.0, 0.0, 1.0)]) | ||
// rr.Radius.ui_points produces radii that the viewer interprets as given in ui units. | ||
.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)]), | ||
); | ||
|
||
Ok(()) | ||
} | ||
|
||
// TODO: unfinished |