Skip to content

Commit

Permalink
Add code examples for linestrip batch API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed Jul 26, 2023
1 parent 788c961 commit faa7765
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/code-examples/line_strip2d_batch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""Log a simple line strip."""
import rerun as rr

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

rr.log_line_strips_2d(
"batch",
[[[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]],
stroke_widths=[0.05, 0.01],
)

# Log an extra rect to set the view bounds
rr.log_rect("bounds", [3, 1.5, 8, 9], rect_format=rr.RectFormat.XCYCWH)
28 changes: 28 additions & 0 deletions docs/code-examples/line_strip3d_batch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Log a batch of line strips."""
import rerun as rr

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

rr.log_line_strips_3d(
"batch",
[
[
[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]],
stroke_widths=[0.05, 0.01],
)
12 changes: 12 additions & 0 deletions docs/content/reference/data_types/linestrip2d.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,15 @@ code-example: line_segments2d_simple
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/196e0f2fe2222526e9eba87fa39440ada08e273d_line_segment2d_simple_1200w.png">
<img src="https://static.rerun.io/53df596662dd9ffaaea5d09d091ef95220346c83_line_segment2d_simple_full.png" alt="">
</picture>

## Batch Examples

code-example: line_strip2d_batch

<picture>
<source media="(max-width: 480px)" srcset="https://static.rerun.io/25e0ef495714636821fcd4dbf373148016bde195_line_strip2d_batch_480w.png">
<source media="(max-width: 768px)" srcset="https://static.rerun.io/b70bf5eefe036f08ed3e48cf4001cf4deebd86e6_line_strip2d_batch_768w.png">
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/44aaefeb430f8209c41df0c2cd4564538196b99d_line_strip2d_batch_1024w.png">
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/e4cdfae79503362acd773bf1d124e95a1026b356_line_strip2d_batch_1200w.png">
<img src="https://static.rerun.io/d8aae7ca3d6c3b0e3b636de60b8067fa2f0b6db9_line_strip2d_batch_full.png" alt="">
</picture>
12 changes: 12 additions & 0 deletions docs/content/reference/data_types/linestrip3d.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,15 @@ code-example: line_segments3d_simple
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/aeed681be95d6c974446f89a6fa26b7d3077adce_line_segment3d_simple_1200w.png">
<img src="https://static.rerun.io/aa800b2a6e6a7b8e32e762b42861bae36f5014bb_line_segment3d_simple_full.png" alt="">
</picture>

## Batch Examples

code-example: line_strip3d_batch

<picture>
<source media="(max-width: 480px)" srcset="https://static.rerun.io/447c7d3d0a75447aa9bad9cfb2c6d68fbe082935_line_strip3d_batch_480w.png">
<source media="(max-width: 768px)" srcset="https://static.rerun.io/d7a16841654a524521f0d26b81771d4e5a740108_line_strip3d_batch_768w.png">
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/2848a42a715b410f433a9b78ddbe599dea2b66f9_line_strip3d_batch_1024w.png">
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/a5ccbe907ea07baeb5117b17dfde41ce11477bf1_line_strip3d_batch_1200w.png">
<img src="https://static.rerun.io/102e5ec5271475657fbc76b469267e4ec8e84337_line_strip3d_batch_full.png" alt="">
</picture>

0 comments on commit faa7765

Please sign in to comment.