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

Revamp object selector and update APIs #2025

Closed
hannobraun opened this issue Sep 21, 2023 · 0 comments · Fixed by #2031
Closed

Revamp object selector and update APIs #2025

hannobraun opened this issue Sep 21, 2023 · 0 comments · Fixed by #2031
Assignees
Labels
topic: core Issues relating to core geometry, operations, algorithms type: feature New features and improvements to existing features

Comments

@hannobraun
Copy link
Owner

I'm seeing opportunities for improvement:

  • Cycle has different methods to select from its referenced edges in various ways, e.g. selecting the n-th edge, selecting the edge that comes after another, etc. While the referenced objects of other objects don't tend to have an inherent order, such an order might be assigned by the context of the user's code, meaning those selector methods could be useful for other objects too.
  • Likewise, UpdateCycle has an additional method to update the n-th edge of a cycle. Having this capability for other update traits could be useful, for the same reason already stated above.
  • I also have concrete use cases for additional selector and update methods (coming out of my work on Implement operation for splitting faces #2023). Adding all of those methods everywhere they are useful would result in a combinatorial explosion.
  • In addition, the update API overall is a bit of a mess anyway. Some update methods take closures, others don't. I think it would be nice to unify that.

The reason I'm packing all of this in a single issue, is that I believe that the same solution will solve all of those! Here's what I have in mind:

  • Add a new HandleSet and use that as the standardized data structure to manage references to other objects in all objects that reference multiple objects of the same type.
  • Add HandleIter, and iterator over the handles in HandleSet, and return that from all the appropriate methods.
  • Move all of those useful selector methods from Cycle to HandleIter, making them available for all referenced objects.
  • Standardize on a single type of update method that is designed to work with the selector methods. I'm picturing something like this: fn update_*(&self, &Handle<T>, impl FnOnce(&Handle<T>) -> Handle<T>) -> Self

I think this would make for a nice improvement, leading not only to more capabilities in the update API, but also better cohesion. I've started working on this, since I have use for it in #2023.

@hannobraun hannobraun added type: feature New features and improvements to existing features topic: core Issues relating to core geometry, operations, algorithms labels Sep 21, 2023
@hannobraun hannobraun self-assigned this Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: core Issues relating to core geometry, operations, algorithms type: feature New features and improvements to existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant