Closing the hole after cutting a triangular mesh

Once a triangular mesh is cut by an intersecting plane, the resulting halves are no longer a water-tight mesh, because some holes are created by the cutting action of the plane.

In the image here, the volume of a [solid] hat was cut by a vertical plane, splitting it in two. In order for this half to be back a 2-manifold triangular mesh, all the triangles with black edges have been added to create a flat surface that covers what the cut plane would otherwise reveal (the inside of the hat).

The problem is how given a certain polygon, like the red polygonal line here, a collection of triangles can be created to cover entirely all the area delimited by such a perimeter (aka polygon triangulation).

The problem gets even more interesting once we consider that some meshes can present holes inside these perimeters obtained after cutting the mesh with a plane.

Fortunately, there are different algorithms to solve that problem, and I will settle with the so-called Ear clipping. Fortunately, there is an open-source java library for doing just that and this is what I used for triangulating the example in the graph.

There is a small warning though, as the code above is only suitable for Java 8 (I know because I had to backport it to an older version installed in my test system).


Comments

Robert smith said…

Very helpful information!Thank you so much for the detailed article
misan said…
You are welcome, Robert.

Popular posts from this blog

VFD control with Arduino using RS485 link

How to get sinusoidal s-curve for a stepper motor

Importing OpenSCAD designs into Onshape