@@ -44,7 +44,7 @@ def log_line_strip(
4444 timeless : bool = False ,
4545) -> None :
4646 r"""
47- Log a line strip through 3D space.
47+ Log a line strip through 2D or 3D space.
4848
4949 A line strip is a list of points connected by line segments. It can be used to draw approximations of smooth curves.
5050
@@ -61,7 +61,7 @@ def log_line_strip(
6161 entity_path:
6262 Path to the path in the space hierarchy
6363 positions:
64- A Nx3 array of points along the path.
64+ An Nx2 or Nx3 array of points along the path.
6565 stroke_width:
6666 Optional width of the line.
6767 color:
@@ -83,7 +83,12 @@ def log_line_strip(
8383 splats : Dict [str , Any ] = {}
8484
8585 if positions is not None :
86- instanced ["rerun.linestrip3d" ] = LineStrip3DArray .from_numpy_arrays ([positions ])
86+ if positions .shape [1 ] == 2 :
87+ instanced ["rerun.linestrip2d" ] = LineStrip2DArray .from_numpy_arrays ([positions ])
88+ elif positions .shape [1 ] == 3 :
89+ instanced ["rerun.linestrip3d" ] = LineStrip3DArray .from_numpy_arrays ([positions ])
90+ else :
91+ raise TypeError ("Positions should be either Nx2 or Nx3" )
8792
8893 if color :
8994 colors = _normalize_colors ([color ])
@@ -132,7 +137,7 @@ def log_line_segments(
132137 entity_path:
133138 Path to the line segments in the space hierarchy
134139 positions:
135- A Nx3 array of points along the path .
140+ An Nx2 or Nx3 array of points. Even-odd pairs will be connected as segments .
136141 stroke_width:
137142 Optional width of the line.
138143 color:
0 commit comments