three-bvh-csg icon indicating copy to clipboard operation
three-bvh-csg copied to clipboard

TriangleSplitter: Enable symmetrical clipping along connected edges

Open gkjohnson opened this issue 3 years ago • 2 comments

Related to #49

Requirements

  • Add a variation of TriangleSplitter that will clip triangles such that edges are symmetrically split so the edges line up and can be connected in the HalfEdgeMap.

Approach

  • When clipping triangles construct polygons from connected loops of edges from the edges derived from triangle intersections.
  • Once all polygons have been found from the split determine whether they're inside or outside the model using the existing determination method (raycasting).
  • For the polygons to keep run the three.js built-in Earcut method to triangulate the polygon to add to the final geometry.

Notes

  • Alternatively the half edge structure could be redesigned to not require a 1:1 relationship on edges. Instead if triangles connect at T-junctions the relationships can be 1 to many, though this would be significantly more complicated and require ensuring the full length of the edge is accounted for.
  • Polygon triangulation:
    • https://algo.kaust.edu.sa/Documents/cs372l05.pdf
    • https://en.wikipedia.org/wiki/Polygon_triangulation
    • https://github.com/mrdoob/three.js/blob/master/src/extras/Earcut.js

gkjohnson avatar Jun 22 '22 02:06 gkjohnson

Hey, we are offering a bounty of $500 for this issue. Whoever solves it, will get that money. 😎

agviegas avatar Sep 15 '22 22:09 agviegas

See approach from paper in #97 which may help limit the amount of unnecessary inserted edge vertices on clipping.

gkjohnson avatar Oct 14 '23 00:10 gkjohnson