Skip to content

Fix split_nonmanifold#2344

Merged
alecjacobson merged 5 commits intomainfrom
alecjacobson/split-nonmanifold
Jan 23, 2024
Merged

Fix split_nonmanifold#2344
alecjacobson merged 5 commits intomainfrom
alecjacobson/split-nonmanifold

Conversation

@alecjacobson
Copy link
Copy Markdown
Contributor

The previous method (and the old one in gptoolbox) was cool cause it wouldn't just create boundaries at the non-manifold edge chains. It would identify big manifold components across non-manifold edges. Unfortunately, it was just getting lucky. It would find those if they were in order in the list of faces, and fail to correctly split the mesh oetherwise. (Some of the new tests will fail the old code).

At one point I set out to implement "Cutting and Stitching: Converting Sets of Polygons to Manifold Surfaces" [Guéziec et al. 2001] but its details are a bit confusing and it's not quite written with proofs so I got nervous I'd make an elaborate implementation and still have failure cases.

Instead, I implemented the "obvious" thing. Split all the edges, then try to stitch them back. Only allow a stitch if the resulting mesh continues to be manifold. The order still matters to get nice components, so this implementation does a depth-first traversal on stitched edges as it goes.

This is purely combinatorial. It'd be cool to use geometry to prefer outputting a "solid" mesh.

Finally, "manifold" doesn't necessarily mean orientable, but this code is assuming the output should also be orientable (I claim the common case). It shouldn't be too hard to add a flag that allows non-orientable output.

@alecjacobson alecjacobson merged commit 7d1614a into main Jan 23, 2024
@alecjacobson alecjacobson deleted the alecjacobson/split-nonmanifold branch January 23, 2024 14:25
@alecjacobson
Copy link
Copy Markdown
Contributor Author

Some thoughts on the geometric version. Ideally, if a solid extraction exists, then it should be found. It's possible for this to still be ambiguous (the bottom steps of this model could have been two components or one):
split-nonmanifold-stairs

This extraction is essentially the same as the nearly combinatorial extract_cells. Where just the cyclic order around the edge (pointing into the screen) matters. So in this case, we must connect B→C and A→D (because B→C appears in cyclic order before B→D).

  B
  ↓
A→o→C
  ↓
  D

But in this case, we could either do B→C,D→A or B→A,D→C because both have no skips in cyclic order. We could further make a geometric rule to prefer the most convex out or something based on dihedral angle difference.

  B
  ↓
A←o→C
  ↑
  D

@alecjacobson
Copy link
Copy Markdown
Contributor Author

Another thought, in "Progressive Shell Quasistatics for Unstructured Meshes" we jiggle nearly colliding vertices into intersection free configurations. Seem unprincipled but I convinced myself that the problem is sufficiently hard that a randomized algorithm is a reasonable response. I think a similar approach would work well for finding a non-self-intersecting, manifold mesh that's close(est) to the input:

  1. Resolve any self-intersections, so they occur at (possibly non-manifold) edges and vertices
  2. split into manifold but overlapping at vertices and edges
  3. jiggle vertices by ε until self-intersection free

Would also be a good use case for the dynamic AABB that just merged.

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.

1 participant