# Algebraic Point Projection for Immersed Boundary Analysis on Low Degree NURBS Curves and Surfaces
## 3 Background on Algebraic Level Sets
### Extension to NURBS Surface  
The algebraic level sets construction can be extended to three-dimensional NURBS surfaces in a straightforward manner by implicitizing the rational parametric surface with the Dixon resultant [25]. Given a rational parametric surface \(\mathbf{S}(X(u,v),Y(u,v),Z(u,v),W(u,v))\) of degree \(p\times q\) with \(x=\frac{X(u,v)}{W(u,v)},y=\frac{Y(u,v)}{W(u,v)}\) and \(z=\frac{Z(u,v)}{W(u,v)}\), three auxiliary polynomials can be formed as follows:  
\[g_{1}(x,u,v) =W(u,v)x-X(u,v)=0 \tag{15a}\] \[g_{2}(y,u,v) =W(u,v)y-Y(u,v)=0\] (15b) \[g_{3}(z,u,v) =W(u,v)z-X(u,v)=0 \tag{15c}\]  
As before, using algebraic elimination theory, one can derive the corresponding resultant system for surface \(\mathbf{S}\):  
\[\left[\mathbf{M}^{D}\right]_{2 pq\times 2 pq}\left(1\quad u\quad\cdots\quad u^{p-1 }\quad\cdots\quad v^{2q-1}\quad uv^{2q-1}\quad\cdots\quad u^{p-1}v^{2q-1} \right)^{T}=0 \tag{16}\]  
where the vector is indexed lexicographically. \(\mathbf{M}^{D}\) is the Dixon matrix, which also possesses a property analogous to Equation (7) of linearity with respect to \(x\), \(y\), and \(z\):  
\[\mathbf{M}^{D}(\mathbf{x})=\mathbf{M}^{D}_{x}x+\mathbf{M}^{D}_{y}y+\mathbf{M}^ {D}_{z}z+\mathbf{M}^{D}_{w} \tag{17}\]  
where, as before, \(\mathbf{M}^{D}_{x},\mathbf{M}^{D}_{y},\mathbf{M}^{D}_{z}\), and \(\mathbf{M}^{D}_{w}\) depend on control point coordinates and weights. The determinant of the Dixon matrix is the Dixon resultant:  
\[\Gamma(\mathbf{x})=\det(\mathbf{M}^{D}(\mathbf{x})) \tag{18}\]  
An example of the algebraic level sets from a free surface is illustrated in Figure 7. The pseudo-code in Algorithm 1 shows the generic steps in algebraic level sets computation for NURBS curves and surfaces. Both NURBS curves and surfaces are denoted by \(\mathbf{C}(\mathbf{u})\) here for notational convenience, with the implicit understanding that \(\mathbf{u}=(u)\) for curves and \(\mathbf{u}=(u,v)\) for surfaces.  
Figure 6: Algebraic level sets of a symmetric cubic spline. \(\mathcal{G}^{0}\) continuity is present at \((x,y)=(-1,0)\) and \((1,0)\). The generated algebraic level sets retain the symmetry while ensuring the smoothness of the field.  
```
1:NURBS curve or surface \(\mathbf{C}(\mathbf{u})\) and given test point \(\mathbf{x}\)
2:Algebraic distance measure \(d\) from \(\mathbf{x}\) to the NURBS entity \(\mathbf{C}(\mathbf{u})\)
3:functionAlgebraic_Distance(\(\mathbf{C}\), \(\mathbf{x}\))
4:\(\mathcal{B}(\mathbf{C})\leftarrow\) Split NURBS entity \(\mathbf{C}\) into a Bezier set with segments \(B_{i}\), \(i=1,2,\cdots,n\)
5:for\(i\gets 1,n\)do\(\triangleright\) Loops are independent and parallelizable
6:\(h_{i}\leftarrow\) Create convex hull for \(B_{i}\in\mathcal{B}(\mathbf{C})\)
7:\(\Gamma_{i}\leftarrow\) Compute the Bezout or Dixon resultant using Equation (8) or Equation (18), respectively
8:\(\Gamma_{i}\leftarrow\frac{\Gamma_{i}}{\|\
abla\Gamma_{i}\|}\)\(\triangleright\) Normalization of the resultant using Equation (14)
9:\(d_{i}\leftarrow\) Carryout Boolean union of distance fields of \(h_{i}\) obtained using Equation (9) with \(\Gamma_{i}\)
10:endfor
11:\(d\leftarrow\) Carryout Boolean intersection of individual level sets \(d_{i}\), \(i=1,2,\cdots,n\) using Equation (10)
12:endfunction
```  
**Algorithm 1** Algebraic level sets algorithm.