Barrier and Distances
With triangle mesh discretization, the barrier potential in the continuous settings (Equation (18.3.5)) can be approximated as where is the set of all surface triangles, is the set of all surface triangles that hold point , and is the point-triangle distance. Further approximating the max operator with summations and use mesh surface nodes as quadrature points, we have where is the integration weight and is the area of node 's incident surface triangle .
Now, getting back to the second line of Equation (24.1.1), if we only use points on the edges to approximate the minimum distance, we obtain Then if we choose a special quadrature point per surface edge and approximate the max operators with summations, we get where is the integration weight and is the area of 's incident surface triangle . Next, if we always select to be the closest point to on , we will get where is the set of all the surface edge neighbors of plus itself. For the summation over all surface edges in Equation (24.1.3), if we only account for with or the other way around, then the coefficient can be omitted.
Now we have two kinds of discretizations for the 3D barrier potential energy. To use them together in practice, we can take advantage of a linear combination of them, and the coefficient could usually be set to .
For point-triangle and edge-edge distances, they are also both small optimization problems with analytical solutions, which can be represented as piecewise smooth functions like the 2D Point-Edge distance in Equation (21.2.1). For example, in the point-triangle case, the expression can be determined by checking which region the projection of the point onto the triangle plane is located.
Definition 24.1.1 (3D Point-Triangle Distance). The distance between point and triangle with vertices , , and can be defined as
Definition 24.1.2 (3D Edge-Edge Distance). The distance between edge with end nodes and and edge with end nodes and can be defined as
Remark 24.1.1 (Smoothness of 3D Distance Functions). Note that the point-triangle distance is at least continuous everywhere. This means that even when the projected point is located on the borders of the piecewise function, the distance gradient still exists and is continuous. However, for edge-edge distance, when the edges are parallel, the distance function is only continuous, as the gradient of the expressions in adjacent regions do not agree. To address this issue, IPC [Li et al. 2020] proposed multiplying a mollifier to the edge-edge barrier energy density function to make the potential continuous everywhere. This mollifier smoothly decreases to zero when the edges are parallel. This ensures that gradient-based optimization methods can still be applied efficiently to solve the problem.