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

Add a half edge structure optimization #49

Merged
merged 31 commits into from
Jun 22, 2022
Merged

Add a half edge structure optimization #49

merged 31 commits into from
Jun 22, 2022

Conversation

gkjohnson
Copy link
Owner

@gkjohnson gkjohnson commented Jun 21, 2022

Related to #27
Fix #34
Fix #50
Fix #3

TODO

  • Add Half Edge structure
  • Add HalfEdgeHelper that visualizes the lines between triangle centers
  • Get half edge structure working on non-group case
    • generate the half edge structure on the brush
    • pick from a list of triangles that isn't clipped and find all triangles
    • find out whether the triangles should be included in the final mesh
    • initialize a set from the triangle indices so we know what to iterate over
  • Get it working with materials & groups
    • possible requires tracking multiple sets of attributes for each group and appending them later
    • may need a cached list of groups for every triangle so they can be added to the correct buffer
    • it seems to be working - but how?! Is it inoptimal?
  • get geometry demo working
  • Multimaterial demo
  • New issues to track further optimizations
  • clean up
  • check for small regression after groups support
    • Attribute Data: change from map first to array first to simplify dictionary accesses

NOTE After clipping the triangles half edges cannot be derived between clipped faces because the edges no longer align. The half edge should still be an improvement but there's still room for more. #4 might help with this if we can generate an optimal polyon/s to triangulate that keep the full edges intact.

Perf improvement is not as dramatic for a few reasons:

  • degraded connectivity after splitting edges (try to ensure sibling edges are aligned correctly after splitting)
  • rebuilding of half edge structure is slow - the rebuilding of the half edge structure actually causes some performance degradation in some cases (try to retain some half edge structure connectivity where possible and rebuild only what's needed)
  • Now the dominating time factor is the splitting (addressed by polygon splitting instead)
  • data appending could also be faster

@gkjohnson gkjohnson marked this pull request as ready for review June 21, 2022 18:10
Repository owner deleted a comment from lgtm-com bot Jun 22, 2022
Repository owner deleted a comment from lgtm-com bot Jun 22, 2022
Repository owner deleted a comment from lgtm-com bot Jun 22, 2022
Repository owner deleted a comment from lgtm-com bot Jun 22, 2022
Repository owner deleted a comment from lgtm-com bot Jun 22, 2022
Repository owner deleted a comment from lgtm-com bot Jun 22, 2022
@gkjohnson
Copy link
Owner Author

gkjohnson commented Jun 22, 2022

New demo object with multiple materials and operations:

image

@gkjohnson gkjohnson merged commit 6acd111 into main Jun 22, 2022
@gkjohnson gkjohnson deleted the halfedge branch June 22, 2022 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant