LineStrips2D

2D line strips with positions and optional colors, radii, labels, etc.

Components components

Required: LineStrip2D

Recommended: Radius, Color

Optional: Text, DrawOrder, ClassId

Shown in shown-in

Examples examples

line_strip2d_simple linestrip2dsimple

"""Log a simple line strip."""

import rerun as rr
import rerun.blueprint as rrb

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

rr.log(
    "strip",
    rr.LineStrips2D([[[0, 0], [2, 1], [4, -1], [6, 0]]]),
)

# Set view bounds:
rr.send_blueprint(rrb.Spatial2DView(visual_bounds=rrb.VisualBounds2D(x_range=[-1, 7], y_range=[-3, 3])))

line_segments2d_simple linesegments2dsimple

"""Log a couple 2D line segments using 2D line strips."""

import numpy as np
import rerun as rr
import rerun.blueprint as rrb

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

rr.log(
    "segments",
    rr.LineStrips2D(np.array([[[0, 0], [2, 1]], [[4, -1], [6, 0]]])),
)

# Set view bounds:
rr.send_blueprint(rrb.Spatial2DView(visual_bounds=rrb.VisualBounds2D(x_range=[-1, 7], y_range=[-3, 3])))

line_strip2d_batch linestrip2dbatch

"""Log a batch of 2D line strips."""

import rerun as rr
import rerun.blueprint as rrb

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

rr.log(
    "strips",
    rr.LineStrips2D(
        [
            [[0, 0], [2, 1], [4, -1], [6, 0]],
            [[0, 3], [1, 4], [2, 2], [3, 4], [4, 2], [5, 4], [6, 3]],
        ],
        colors=[[255, 0, 0], [0, 255, 0]],
        radii=[0.025, 0.005],
        labels=["one strip here", "and one strip there"],
    ),
)

# Set view bounds:
rr.send_blueprint(rrb.Spatial2DView(visual_bounds=rrb.VisualBounds2D(x_range=[-1, 7], y_range=[-3, 6])))