Many textbooks describe GA as being ‘exception-less’, i.e., exception cases are not always needed. E.g., the meet of two planes is always a line—although the line may be ideal if the planes are parallel. How far does this concept extend? I’m using PGA-3D to solve the problem of bisecting a triangular-mesh volume with a cutting plane. Namely, given an implicit 3D volume defined by a closed, coherently oriented triangular mesh and an arbitrary 3D plane which bisects the mesh volume, find the volume of the mesh ‘above’ and ‘below’ the plane. So my question is this: can this bisection of the triangular mesh be done without resource to conditional, branching code?

My current strategy is as follows. First, I compute the distances of all mesh vertices to the cutting plane. Next I disposition each triangle based on the sign of these vertex distances: positive, negative, and zero. For example, if the signs are all positive, the triangle is ‘above’ the cutting plane. Likewise, if the signs are all negative, the triangle is ‘below’ the cutting plane. If the signs are mixed or zero, then the triangle is either bisected by the plane, touches the plane, or lies entirely in the plane. If the triangle is bisected, it is fragmented along the meet of the plane and the triangle. This process allows me to update the mesh and split it into exactly two sets, those ‘above’ and those ‘below’ the plane. Due to the multiple topologies that need to be handled (namely, 3^3 =27 combinations, as each vertex distance can be negative, zero, or positive), I see no way to avoid coding multiple conditional branches—the disposition of each topological condition needs to be uniquely handled. Or does it?