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

Arrow3D migration to archetypes #2785

Closed
16 tasks done
Tracked by #2795
teh-cmc opened this issue Jul 24, 2023 · 2 comments · Fixed by #2916
Closed
16 tasks done
Tracked by #2795

Arrow3D migration to archetypes #2785

teh-cmc opened this issue Jul 24, 2023 · 2 comments · Fixed by #2916
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 2, 2023
What the title says.

This does **not** migrate off of the legacy `Arrow3D`, that's for a
future PR.

---

Python:
```python
lengths = np.log2(np.arange(0, 100) + 1)
angles = np.arange(start=0, stop=tau, step=tau * 0.01)
vectors = np.column_stack([np.sin(angles) * lengths, np.zeros(100), np.cos(angles) * lengths])
arrows = [rrd.Arrow3D(origin=[0, 0, 0], vector=v) for v in vectors]
colors = [[1.0 - c, c, 0.5, 0.5] for c in angles / tau]

rr2.log("arrows", rr2.Arrows3D(arrows, colors=colors))
```

Rust:
```rust
let (arrows, colors): (Vec<_>, Vec<_>) = (0..100)
    .map(|i| {
        let angle = TAU * i as f32 * 0.01;
        let length = ((i + 1) as f32).log2();
        let c = (angle / TAU * 255.0) as u8;
        (
            Arrow3D::new(
                Vec3D::ZERO,
                [length * angle.sin(), 0.0, length * angle.cos()],
            ),
            Color::from_unmultiplied_rgba(255 - c, c, 128, 128),
        )
    })
    .unzip();

MsgSender::from_archetype("arrows", &Arrows3D::new(arrows).with_colors(colors))?
    .send(&rec_stream)?;

```

Output:

![image](https://github.com/rerun-io/rerun/assets/2910679/1c2884b0-24cf-4802-9c95-9221e53bdadf)

---

Related: 
- #2884

Part of #2785 

### 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/2883) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/2883)
- [Docs preview](https://rerun.io/preview/pr%3Acmc%2Farrow3d/docs)
- [Examples
preview](https://rerun.io/preview/pr%3Acmc%2Farrow3d/examples)
teh-cmc added a commit that referenced this issue Aug 2, 2023
What the title says.

There's a bonus, the `Arrow3D` space view part now supports labels and
class ids!


![image](https://github.com/rerun-io/rerun/assets/2910679/17396877-e3e4-44fa-a6bf-7a9c271e3178)

Part of #2785 

### 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/2886) (if
applicable)

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

### What

Adds C++ example build setup and examples for:

* Point3D  #2789
* Arrow3D #2785
* DisconnectedSpace #2791

as before Point2D example is blocked on rects for the moment.

Generating a bunch more methods now for better usability. Still lacking
user extensions though, in particular Point3D construction is poor right
now

Examples can be built in bulk with `
./tests/cpp/build_all_doc_examples.sh`
Then run with `./build/tests/cpp/doc_example_point3d_EXAMPLE_NAME`
They all connect to localhost on default port for now.


Point3D Simple:
<img width="1336" alt="image"
src="https://github.com/rerun-io/rerun/assets/1220815/61ca8dba-690f-4bcf-96d2-25cb010881fb">

Point3D Random:
<img width="1341" alt="image"
src="https://github.com/rerun-io/rerun/assets/1220815/48fa902d-7858-4580-b64b-69815dab47e3">

Arrow3D:
<img width="1360" alt="image"
src="https://github.com/rerun-io/rerun/assets/1220815/131d0efa-af94-418a-b08f-653c1d9eafb0">

Disconnected Space:
<img width="1339" alt="image"
src="https://github.com/rerun-io/rerun/assets/1220815/5da1bb64-984a-4ff5-903a-1ea060dd296a">

Dependent on #2906 

### 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/2908) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/2908)
- [Docs
preview](https://rerun.io/preview/pr%3Aandreas%2Fcpp%2Fexamplesv2/docs)
- [Examples
preview](https://rerun.io/preview/pr%3Aandreas%2Fcpp%2Fexamplesv2/examples)
@Wumpf
Copy link
Member

Wumpf commented Aug 7, 2023

all the infrastructure to move forward is in place!
C++ codegen is missing a few features, but we'll add them as we go

@Wumpf Wumpf closed this as completed Aug 7, 2023
Wumpf added a commit that referenced this issue Aug 7, 2023
### What

Introduces a simple extension system for C++ codegen: Add an extra cpp
file that will be compiled as part of the SDK. A section between two
markes is copied into the generated hpp as part of generation (typically
this section is removed from compilation via #ifdef)

Adds extensions to:
* color
* vec2/vec3/vec4
* quaternion
* origin3d
* point2d
* point3d
* arrow3d

... and uses them to simplify examples and test code!

All fully supported archetypes now have a simple test that checks that
the base interface works and that we can serialize out to arrow without
issues.

Additionally, there's tests for vecN/quaternion/color to check that
their various constructors work as expected (not being a C++ expert it's
fairly hard to predict)

Extends codegen with single-array-field-constructors.


---------

* part of #2647
* Fixes #2798
* Fixes #2785
* Missing only 2D example: #2789
* Adds to #2791 


### 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/2916) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/2916)
- [Docs
preview](https://rerun.io/preview/pr%3Aandreas%2Fcpp%2Fcustom-extensions/docs)
- [Examples
preview](https://rerun.io/preview/pr%3Aandreas%2Fcpp%2Fcustom-extensions/examples)
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.

2 participants