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

extract polygon holes when converting initial shape geometry #246

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

mistafunk
Copy link
Collaborator

No description provided.

@mistafunk mistafunk self-assigned this Mar 27, 2025
@mistafunk mistafunk force-pushed the shaegler/initial-shapes-with-holes branch 2 times, most recently from 8de5fc0 to b999ced Compare March 31, 2025 10:41
@mistafunk mistafunk force-pushed the shaegler/initial-shapes-with-holes branch from b999ced to b29a734 Compare March 31, 2025 12:42
@mistafunk mistafunk requested a review from chr11115 March 31, 2025 12:44
Copy link
Contributor

@chr11115 chr11115 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!
I think we should generalize the code such that we can test it. There is also some room for improvement in naming/organization (some of it is opinionated and you can leave it if you feel strongly about some of the structure/names), but overall great stuff!

FaceWithHoles info(1); // insert the (yet empty) actual face

size_t ringIdx = 0; // stack-like indexing to jump into the holes and back out again
for (auto const& edge : edges) {
Copy link
Contributor

@chr11115 chr11115 Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

traversing like this will push the holes in the order houdini creates the bridge edges which is arbitrary. This is probably fine, but maybe the holes should be sorted in a particular order independent on where the bridge edges lie (maybe there is some heuristic with lowest/highest point index that would restore the original order? Maybe sidefx ppl know more..)

FaceWithHoles extractHoles(GEO_Face const& face) {
const auto [bridges, edges] = detectBridgeEdges(face);
if (bridges.empty())
return {};
Copy link
Contributor

@chr11115 chr11115 Apr 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could simplify this by just returning traverseBridgeEdges...
We could also have a struct where face: vector<GA_Offset>, holes: vector<vector<GA_Offset>> are properly separated so we don't need to know implementation details when interacting with it.

I understand that in the no-bridge case the vertex indices are just ascending and storing that seems a bit like a waste.
But I still think It's a bit odd to either return face + holes or nothing at all. Maybe this could at least be documented why, if we leave it as-is? (That vertex order is expected to be 1,2,...,n in no-hole case, but not with holes)

I'll let you grok on it for a bit :)

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.

2 participants