From 951145864b65d7e3f70cf955c6de0c6ba65896a5 Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Fri, 11 Oct 2024 15:21:07 -0700 Subject: [PATCH 1/2] Use `log_static()` for constant data in DNA example. This gives better results when viewing with a time range query. --- examples/rust/dna/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/rust/dna/src/main.rs b/examples/rust/dna/src/main.rs index 8ffc94009cb6..e25c82c537df 100644 --- a/examples/rust/dna/src/main.rs +++ b/examples/rust/dna/src/main.rs @@ -20,13 +20,13 @@ fn main() -> Result<(), Box> { rec.set_time_seconds("stable_time", 0f64); - rec.log( + rec.log_static( "dna/structure/left", &rerun::Points3D::new(points1.iter().copied()) .with_colors(colors1) .with_radii([0.08]), )?; - rec.log( + rec.log_static( "dna/structure/right", &rerun::Points3D::new(points2.iter().copied()) .with_colors(colors2) @@ -41,7 +41,7 @@ fn main() -> Result<(), Box> { .map(|chunk| chunk.into_iter().collect_vec().try_into().unwrap()) .collect_vec(); - rec.log( + rec.log_static( "dna/structure/scaffolding", &rerun::LineStrips3D::new(points_interleaved.iter().cloned()) .with_colors([rerun::Color::from([128, 128, 128, 255])]), From 253176d9e3b0f34728d7bcb8cc84755dd68a6cd0 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Fri, 15 Nov 2024 10:44:31 +0100 Subject: [PATCH 2/2] make C++ & Python also use static --- examples/cpp/dna/main.cpp | 6 +++--- examples/python/dna/dna.py | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/examples/cpp/dna/main.cpp b/examples/cpp/dna/main.cpp index d7b257c0364c..25b50981fdca 100644 --- a/examples/cpp/dna/main.cpp +++ b/examples/cpp/dna/main.cpp @@ -21,11 +21,11 @@ int main() { rec.set_time("stable_time", 0s); - rec.log( + rec.log_static( "dna/structure/left", rerun::Points3D(points1).with_colors(colors1).with_radii({0.08f}) ); - rec.log( + rec.log_static( "dna/structure/right", rerun::Points3D(points2).with_colors(colors2).with_radii({0.08f}) ); @@ -35,7 +35,7 @@ int main() { lines.emplace_back(rerun::LineStrip3D({points1[i].xyz, points2[i].xyz})); } - rec.log( + rec.log_static( "dna/structure/scaffolding", rerun::LineStrips3D(lines).with_colors(rerun::Color(128, 128, 128)) ); diff --git a/examples/python/dna/dna.py b/examples/python/dna/dna.py index b0d71e7d9a78..06f9730c1ace 100755 --- a/examples/python/dna/dna.py +++ b/examples/python/dna/dna.py @@ -30,10 +30,14 @@ def log_data() -> None: # points and colors are both np.array((NUM_POINTS, 3)) points1, colors1 = build_color_spiral(NUM_POINTS) points2, colors2 = build_color_spiral(NUM_POINTS, angular_offset=tau * 0.5) - rr.log("helix/structure/left", rr.Points3D(points1, colors=colors1, radii=0.08)) - rr.log("helix/structure/right", rr.Points3D(points2, colors=colors2, radii=0.08)) - - rr.log("helix/structure/scaffolding", rr.LineStrips3D(np.stack((points1, points2), axis=1), colors=[128, 128, 128])) + rr.log("helix/structure/left", rr.Points3D(points1, colors=colors1, radii=0.08), static=True) + rr.log("helix/structure/right", rr.Points3D(points2, colors=colors2, radii=0.08), static=True) + + rr.log( + "helix/structure/scaffolding", + rr.LineStrips3D(np.stack((points1, points2), axis=1), colors=[128, 128, 128]), + static=True, + ) time_offsets = np.random.rand(NUM_POINTS) for i in range(400):