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

Nicer linestrip constructor #3967

Closed
wants to merge 2 commits into from
Closed

Nicer linestrip constructor #3967

wants to merge 2 commits into from

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Oct 23, 2023

What

Technically not the exact syntax asked for. But pretty pretty close :)

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested demo.rerun.io (if applicable)
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG

@Wumpf Wumpf added 🌊 C++ API C/C++ API specific exclude from changelog PRs with this won't show up in CHANGELOG.md labels Oct 23, 2023
@Wumpf
Copy link
Member Author

Wumpf commented Oct 24, 2023

Let's not merge until we decided whether #3971 is better

@Wumpf Wumpf added the do-not-merge Do not merge this PR label Oct 24, 2023
Wumpf added a commit that referenced this pull request Oct 24, 2023
…be used to construct the inner component (#3971)

### What

As an alternative (or in addition to)
#3967 this introduces a pattern
wherein any `ComponentBatch<C>` can be constructed from any `Vec<T>`
where we have implemented an extension for constructing `C` from `T`.

Additionally, this introduces a similar extension for constructing
linestrips from vecs of Vec3-like things so that users don't event need
to pick up a Vec3 dependency if they don't want to.

These two combine to allow:
```
    std::vector<std::vector<std::array<float, 3>>> points = {
        {{0.f, 0.f, 0.f}, {0.f, 0.f, 1.f}},
        {{1.f, 0.f, 0.f}, {1.f, 0.f, 1.f}},
        {{1.f, 1.f, 0.f}, {1.f, 1.f, 1.f}},
        {{0.f, 1.f, 0.f}, {0.f, 1.f, 1.f}},
    };

    rec.log("segments", rerun::LineStrips3D(points));
```

To do the correct thing.

I think this is important, relative to the variadic / initializer-list
approach since it's more likely to match the kind of patterns users will
encounter in the real-world, where they want to build a Vec of Vecs
without needing to instantiate rerun types directly.

### 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/{{
pr.number }}) (if applicable)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG

- [PR Build Summary](https://build.rerun.io/pr/{{ pr.number }})
- [Docs preview](https://rerun.io/preview/{{ pr.commit }}/docs)
<!--DOCS-PREVIEW-->
- [Examples preview](https://rerun.io/preview/{{ pr.commit }}/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)

---------

Co-authored-by: Andreas Reich <[email protected]>
@Wumpf
Copy link
Member Author

Wumpf commented Oct 24, 2023

replaced by #3971

@Wumpf Wumpf closed this Oct 24, 2023
@Wumpf Wumpf deleted the andreas/cpp/nicer-linestrips branch October 24, 2023 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌊 C++ API C/C++ API specific do-not-merge Do not merge this PR exclude from changelog PRs with this won't show up in CHANGELOG.md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LineStripsND C++ constructors are unfriendly with multiple strips
2 participants