# Overview of GAMer Algorithms¶

## Local Structure Tensor (LST)¶

To represent information about the local geometry, mesh processing operations in `GAMer`

use a Local Structure Tensor (LST).
The LST is defined as follows,

where \(\mathbf{v}\) is the vertex of interest, \(N_r\) is the number of neighbors in the \(r\)-ring neighborhood, and \(n_{i}^{x,y,z}\) form the normal of the \(i\)-th neighbor vertex. Vertex normals are defined as the weighted average of incident face normals. Performing the eigendecomposition of the LST, we obtain information on the principal orientations of normals in the local neighborhood. The magnitude of the eigenvalue corresponds to the amount of curvature along the direction of the corresponding eigenvector. Inspecting the magnitude of the eigenvalues gives several geometric cases:

Planes: \(\lambda_1 \gg \lambda_2 \approx \lambda_3 \approx 0\)

Ridges and valleys: \(\lambda_1 \approx \lambda_2 \gg \lambda_3 \approx 0\)

Spheres and saddles: \(\lambda_1 \approx \lambda_2 \approx \lambda_3 > 0\)

## Weighted Vertex Smooth¶

The `Smooth`

algorithm use an angle-weighted Laplacian smoothing approach, as shown in Fig. 1.

Given a vertex \(\mathbf{x}\) with the set of 1-ring neighbors \(\{\mathbf{v}_1,\ldots,\mathbf{v}_N\}\), where \(N\) is the number of neighbors, ordered such that \(\mathbf{v}_i\) is connected to \(\mathbf{v}_{i-1}\) and \(\mathbf{v}_{i+1}\) by edges. The 1-ring is connected such that \(\mathbf{v}_{N+1} := \mathbf{v}_1\) and \(\mathbf{v}_{-1} := \mathbf{v}_N\). Traversing the 1-ring neighbors, we define edge vectors \(\mathbf{e}_{i-1} := \overrightarrow{\mathbf{v}_i\mathbf{v}_{i-1}}\) and \(\mathbf{e}_{i+1} := \overrightarrow{\mathbf{v}_i\mathbf{v}_{i+1}}\). This algorithm seeks to move \(\mathbf{x}\) to lie on the perpendicularly bisecting plane \(\Pi_i\) of \(\angle(\mathbf{v}_{i-1}, \mathbf{v}_{i}, \mathbf{v}_{i+1})\). For each vertex in the 1-ring neighbors, we compute the perpendicular projection, \(\mathbf{x}_i\), of \(\mathbf{x}\) onto \(\Pi_i\). Since small surface mesh angles are more sensitive to change in \(\mathbf{x}\) position than large angles, we prioritize their maximization. We define a weighting factor, \(\alpha_i = \frac{\mathbf{e}_{i-1}\cdot\mathbf{e}_{i+1}}{\lvert\mathbf{e}_{i-1}\rvert\cdot\lvert\mathbf{e}_{i+1}\rvert}\), which inversely corresponds with \(\angle(\mathbf{v}_{i-1}, \mathbf{v}_{i}, \mathbf{v}_{i+1})\). The average of the projections weighted by \(\alpha_i\) gives a new position of \(\mathbf{x}\) as follows,

To maintain the fidelity of the local geometry we restrict vertex movement along directions of low curvature. This constraint is achieved by anisotropically dampening vertex diffusion using information contained in the LST. Computing the eigendecomposition of the LST, we obtain eigenvalues \(\lambda_1, \lambda_2, \lambda_3\) and eigenvectors \(\mathbf{E}_1, \mathbf{E}_2, \mathbf{E}_3\), which correspond to principal orientations of local normals. We project \(\bar{\mathbf{x}}-\mathbf{x}\) onto the eigenvector basis and scale each component by the inverse of the corresponding eigenvalue,

This has the effect of dampening movement along directions of high curvature i.e., where \(\lambda\) is large.

## Mesh Decimation¶

Mesh coarsening/decimation algorithms in `GAMer`

use a vertex removal based algorithm.
First, vertices are selected to be removed based upon some criteria, discussed below.
We then remove the vertex and re-triangulate the resulting hole.
This is achieved using a recursive triangulation approach, which heuristically balances the edge valency.
Given the boundary loop, we first connect vertices with the fewest incident edges.
This produces two resulting holes that we then fill recursively using the same approach.
When a hole contains only three boundary vertices, they are connected to make a face.
We note that while this triangulation scheme balances vertex valency, it may degrade mesh quality.
We solve this by using weighted vertex smooth on the local region.

We employ two criteria for selecting vertices to remove. First, to selectively decimate vertices in low or high curvature regions, again information from the LST can be used. By comparing the magnitudes of the eigenvalues of the LST we can select for regions with different geometries. For example, to decimate vertices in flat regions of the mesh, given eigenvalues \(\lambda_1 \geq \lambda_2 \geq \lambda_3\), vertices can be selected by checking if the local region satisfies,

where \(R_1\) is a user specified flatness threshold (smaller is flatter). In a similar fashion, vertices in curved regions can also be selected. However, decimation of curved regions is typically avoided due to the potential for losing geometric information.

Instead, to simplify dense areas of the mesh, we employ an edge length based selection criterion,

\[\frac{\mathrm{max}_{i=1}^{N_1}d(\mathbf{x}, \mathbf{v}_i)}{\overline{D}} < R_2,\]

where \(N_1\) is the number of vertices in the 1-ring neighborhood of vertex \(\mathbf{x}\), \(d(\cdot,\cdot)\) is the distance between vertices \(\mathbf{x}\) and \(\mathbf{v}_i\), \(\overline{D}\) is the mean edge length of the mesh, and \(R_2\) is a user specified threshold. This criterion allows us to control the sparseness of the mesh.

## Anisotropic Normal Smooth¶

To produce smoothly varying normals across the mesh without compromising mesh angle quality we use an anisotropic normal smoothing algorithm shown in Fig. 2. Given a vertex \(\mathbf{x}\) of interest, for each incident face \(i\), with normal \(\mathbf{n}_i\) we rotate \(\mathbf{x}\) around a rotation axis defined by opposing edge \(e_i\) such that \(\mathbf{n}_i\) aligns with the mean normal of neighboring faces \(\bar{\mathbf{n}_i} = \sum_{j=1}^{3} \mathbf{n}_{ij}/3\). We denote the new position which aligns \(\mathbf{n}_i\) and \(\bar{\mathbf{n}_i}\) as \(R(\mathbf{x};e_i, \theta_i)\). Summing up the rotations and weighting by incident face area, \(a_i\), we get an updated position,

This is an isotropic scheme that is independent of the local geometric features; meaning that many iterations of this algorithm may weaken sharp features.

Instead, we use an anisotropic scheme to compute the mean neighbor normals,

where \(K\) is a user defined positive parameter which scales the extent of anisotropy. Under this scheme, the weighting function decreases as a function of the angle between \(\mathbf{n}_i\) and \(\mathbf{n}_{ij}\) resulting in the preservation of sharp features.