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

Use log_static() for constant data in DNA example. #7701

Merged
merged 3 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions examples/cpp/dna/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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})
);
Expand All @@ -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))
);
Expand Down
12 changes: 8 additions & 4 deletions examples/python/dna/dna.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions examples/rust/dna/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

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)
Expand All @@ -40,7 +40,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.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])]),
Expand Down
Loading