LineStrips3D
3D line strips with positions and optional colors, radii, labels, etc.
Components components
Required: LineStrip3D
Shown in shown-in
- Spatial3DView
- Spatial2DView (if logged above active projection)
API reference links api-reference-links
Examples examples
Simple example simple-example
"""Log a simple line strip."""
import rerun as rr
rr.init("rerun_example_line_strip3d", spawn=True)
points = [
[0, 0, 0],
[0, 0, 1],
[1, 0, 0],
[1, 0, 1],
[1, 1, 0],
[1, 1, 1],
[0, 1, 0],
[0, 1, 1],
]
rr.log("strip", rr.LineStrips3D([points]))
Many individual segments many-individual-segments
#!/usr/bin/env python3
"""Log a simple set of line segments."""
import numpy as np
import rerun as rr
rr.init("rerun_example_line_segments3d", spawn=True)
rr.log(
"segments",
rr.LineStrips3D(
np.array(
[
[[0, 0, 0], [0, 0, 1]],
[[1, 0, 0], [1, 0, 1]],
[[1, 1, 0], [1, 1, 1]],
[[0, 1, 0], [0, 1, 1]],
],
)
),
)
Many strips many-strips
"""Log a batch of 3D line strips."""
import rerun as rr
rr.init("rerun_example_line_strip3d_batch", spawn=True)
rr.log(
"strips",
rr.LineStrips3D(
[
[
[0, 0, 2],
[1, 0, 2],
[1, 1, 2],
[0, 1, 2],
],
[
[0, 0, 0],
[0, 0, 1],
[1, 0, 0],
[1, 0, 1],
[1, 1, 0],
[1, 1, 1],
[0, 1, 0],
[0, 1, 1],
],
],
colors=[[255, 0, 0], [0, 255, 0]],
radii=[0.025, 0.005],
labels=["one strip here", "and one strip there"],
),
)
Lines with scene & UI radius each lines-with-scene--ui-radius-each
"""Log lines with ui points & scene unit radii."""
import rerun as rr
rr.init("rerun_example_line_strip3d_ui_radius", spawn=True)
# A blue line with a scene unit radii of 0.01.
points = [[0, 0, 0], [0, 0, 1], [1, 0, 0], [1, 0, 1]]
rr.log(
"scene_unit_line",
rr.LineStrips3D(
[points],
# By default, radii are interpreted as world-space units.
radii=0.01,
colors=[0, 0, 255],
),
)
# A red line with a ui point radii of 5.
# 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.
points = [[3, 0, 0], [3, 0, 1], [4, 0, 0], [4, 0, 1]]
rr.log(
"ui_points_line",
rr.LineStrips3D(
[points],
# rr.Radius.ui_points produces radii that the viewer interprets as given in ui points.
radii=rr.Radius.ui_points(5.0),
colors=[255, 0, 0],
),
)