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

Linestrip{2|3}D migration to archetypes #2787

Closed
14 of 16 tasks
Tracked by #2795
teh-cmc opened this issue Jul 24, 2023 · 1 comment · Fixed by #3351
Closed
14 of 16 tasks
Tracked by #2795

Linestrip{2|3}D migration to archetypes #2787

teh-cmc opened this issue Jul 24, 2023 · 1 comment · Fixed by #3351
Assignees
Labels
🏹 arrow concerning arrow 🌊 C++ API C/C++ API specific codegen/idl 🐍 Python API Python logging API 🦀 Rust API Rust logging API

Comments

@teh-cmc
Copy link
Member

teh-cmc commented Jul 24, 2023

Turn into sub-issues as needed.

  • Python support
    • Extensions
    • Unit test (constructors, serialization)
    • Doc example
  • Rust support
    • Extensions
    • Unit test (constructors, rust-to-rust roundtrip)
    • Doc example
  • C++ support
    • Extensions
    • Unit test (constructors, serialization)
    • Doc example
  • Cross-language roundtrip test
  • Remove old components
    • Clean up re_components
    • Port viewer to use new types and queries
@teh-cmc teh-cmc added 🐍 Python API Python logging API 🏹 arrow concerning arrow 🦀 Rust API Rust logging API codegen/idl 🌊 C++ API C/C++ API specific labels Jul 24, 2023
@teh-cmc teh-cmc self-assigned this Jul 28, 2023
@teh-cmc
Copy link
Member Author

teh-cmc commented Jul 28, 2023

Grabbing this one as this overlaps with the migration of Transform3D which touches Vec*D and Mat*x*.

@teh-cmc teh-cmc added this to the 0.9 milestone Aug 1, 2023
teh-cmc added a commit that referenced this issue Aug 8, 2023
What the title says.

This does **not** migrate off of the legacy `LineStrip{2|3}D`, that's
for a future PR.


---
## Python

Before:
```python
"""Log a simple set of line segments."""
import rerun as rr

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

rr.log_line_segments(
    "simple",
    [[0, 0], [2, 1], [4, -1], [6, 0]],
)
```

After:
```python
"""Log a simple set of line segments."""
import numpy as np
import rerun as rr
import rerun.experimental as rr2

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

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

## Rust

Before:
```rust
//! Log a simple line segment.
use rerun::{
    components::{LineStrip2D, Rect2D},
    datatypes::Vec4D,
    MsgSender, RecordingStreamBuilder,
};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let (rec_stream, storage) = RecordingStreamBuilder::new(env!("CARGO_BIN_NAME")).memory()?;

    let points = vec![[0., 0.], [2., 1.], [4., -1.], [6., 0.]];
    MsgSender::new("simple")
        .with_component(
            &points
                .chunks(2)
                .map(|p| LineStrip2D(vec![p[0].into(), p[1].into()]))
                .collect::<Vec<_>>(),
        )?
        .send(&rec_stream)?;

    rerun::native_viewer::show(storage.take())?;
    Ok(())
}
```


After:
```rust
//! Log a couple 2D line segments using 2D line strips.

use rerun::{
    archetypes::LineStrips2D, components::Rect2D, datatypes::Vec4D, MsgSender,
    RecordingStreamBuilder,
};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let (rec_stream, storage) = RecordingStreamBuilder::new(env!("CARGO_BIN_NAME")).memory()?;

    let points = [[0., 0.], [2., 1.], [4., -1.], [6., 0.]];
    MsgSender::from_archetype("segments", &LineStrips2D::new(points.chunks(2)))?
        .send(&rec_stream)?;

    rerun::native_viewer::show(storage.take())?;
    Ok(())
}
```

## Result


![image](https://github.com/rerun-io/rerun/assets/2910679/cb9d3fed-8742-424f-b0e6-7566f5170b36)


Part of #2787 

### What

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/2925) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/2925)
- [Docs
preview](https://rerun.io/preview/pr%3Acmc%2Fnext_gen_linestrips/docs)
- [Examples
preview](https://rerun.io/preview/pr%3Acmc%2Fnext_gen_linestrips/examples)

---------

Co-authored-by: Jeremy Leibs <[email protected]>
teh-cmc added a commit that referenced this issue Aug 8, 2023
What the title says.

There's a bonus, the `LineStrip{2|3}D` space view parts now support
labels and class ids!


![image](https://github.com/rerun-io/rerun/assets/2910679/2b78c5ed-70df-4395-8e26-4a1e0d674974)

Part of #2787 

### What

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/2929) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/2929)
- [Docs
preview](https://rerun.io/preview/pr%3Acmc%2Fgoodbye_old_linestrips/docs)
- [Examples
preview](https://rerun.io/preview/pr%3Acmc%2Fgoodbye_old_linestrips/examples)
Wumpf added a commit that referenced this issue Aug 11, 2023
### What

Was happy with the look of the interface as is, so no extension types
this time around, which also keeps the tests simple :)

<img width="1039" alt="image"
src="https://github.com/rerun-io/rerun/assets/1220815/3cfa4364-1788-4e72-a5e5-3d32f7b7deac">

* fixes most of #2787
* again, one roundtrip test couldn't be implemented because of rects. I
implemented the examples already this time but without the extra rect -
for lines it's not actually necessary, still looks alright
* part of #2919  

<img width="1080" alt="image"
src="https://github.com/rerun-io/rerun/assets/1220815/b8b95ac8-4387-44c8-a890-6f75fcb409df">



### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/2956) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/2956)
- [Docs
preview](https://rerun.io/preview/pr%3Aandreas%2Fcpp%2Flines/docs)
- [Examples
preview](https://rerun.io/preview/pr%3Aandreas%2Fcpp%2Flines/examples)

---------

Co-authored-by: Jeremy Leibs <[email protected]>
Wumpf added a commit that referenced this issue Sep 19, 2023
…Box2D (#3351)

### What

* Fixes #2787 
* Fixes #2789
* Fixes #2786 
   * once  #3348 is in

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/3351) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/3351)
- [Docs
preview](https://rerun.io/preview/a655edeb1a52100c77b9a5e6432b8eaaeab083f7/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/a655edeb1a52100c77b9a5e6432b8eaaeab083f7/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏹 arrow concerning arrow 🌊 C++ API C/C++ API specific codegen/idl 🐍 Python API Python logging API 🦀 Rust API Rust logging API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant