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

Simplify creation of boundary representation #254

Merged
merged 14 commits into from
Feb 25, 2022
Merged

Simplify creation of boundary representation #254

merged 14 commits into from
Feb 25, 2022

Conversation

hannobraun
Copy link
Owner

Merges most methods of the ToShape trait (renamed from Shape) into a single to_shape method, where the boundary representation of the shape is created. This simplifies the ToShape implementations somewhat (although it also created some methods that are now way too long).

This is not a pure refactoring. Some shapes that would have previously panicked, if vertices, edges, or faces were requested from them (because that functionality had not yet been implemented), will now just return no vertices/edges/faces. In the short term, that might replace what would have been obvious errors with silent failures, leading to more bugs.

I don't like this, but I think it's a worthwhile trade-off. The new approach, with the single Shape struct that holds all vertices/edges/faces of a shape, provides a much better basis for future cleanups, as well as for adding more validation. Specifically, this enables #242, and the sweep clean-ups required to continue work on #97.

Close #176

It fits better there. The modules in there is where it's implemented,
after all.
I'm going to need the name `Shape` for another type I'm going to add.
The struct it returns is just a placeholder right now, but the method is
intended to replace `ToShape::faces`, `ToShape::edges`, and
`ToShape::vertices`.
This is not a pure refactoring, as there's one shape that would have
previously panicked, if faces were requested from it, which now just
returns no faces.
This is going to help with merging `edges` into `to_shape`.
This is not a pure refactoring, as there are shapes that would have
previously panicked, if edges were requested from them, which now just
returns no edges.
This will make merging `vertices` into `to_shape` easier.
No vertices are required to compute the bounding volume of the sketch,
so none should be created.
This is not a pure refactoring, as there are shapes that would have
previously panicked, if vertices were requested from them, which now
just returns no vertices.
The issue it describes has been resolved, thanks to the redesign of the
`ToShape` trait.
@hannobraun hannobraun enabled auto-merge February 25, 2022 17:34
@hannobraun hannobraun merged commit 4e311cd into main Feb 25, 2022
@hannobraun hannobraun deleted the shape branch February 25, 2022 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redesign Shape trait
1 participant