Computation of piece-wise linear hat functions I have a discretized 3D surface for which I want to compute piece-wise linear hat functions. I assumed these functions are of the following form:
$$\phi = ax + by + cz + d$$
with the property of $\phi_i(x_j) = \delta_{ij}$.
For a general 3D surface, the number of neighbors for each vertex is different, ranging from 3 to 6 or even more. For example, in the figure below, 3D vertex $i$ has 6 neighbors. This means:
$$
\phi_{17}(x_{17}) = ax_{17} + by_{17} + cz_{17} + d_{17} = 1,\\
\phi_{17}(x_{11}) = ax_{11} + by_{11} + cz_{11} + d_{11} = 0,\\
\phi_{17}(x_{12}) = ax_{12} + by_{12} + cz_{12} + d_{12} = 0,\\
\phi_{17}(x_{13}) = ax_{13} + by_{13} + cz_{13} + d_{13} = 0,\\
\phi_{17}(x_{14}) = ax_{14} + by_{14} + cz_{14} + d_{14} = 0,\\
\phi_{17}(x_{15}) = ax_{15} + by_{15} + cz_{15} + d_{15} = 0,\\
\phi_{17}(x_{16}) = ax_{16} + by_{16} + cz_{16} + d_{16} = 0.\\
$$

The system of equations for vertex 17 is overdetermined (7 equations and 4 unknowns) and not necessarily lead to a set of coefficients, $(a, b, c, d)$, that satisfy $\phi_i(x_j) = \delta_{ij}$.
I was wondering how piece-wise linear hat functions should be computed for such surfaces to guarantee the hat function is $1$ at vertex $i$ and $0$ at all other vertices.
 A: First define one triangle and interpolations as follows:
$$
\begin{bmatrix} x \\ y \\ z \end{bmatrix} =
\begin{bmatrix} x_1 \\ y_1 \\ z_1 \end{bmatrix} +
\begin{bmatrix} x_2-x_1 \\ y_2-y_1 \\ z_2-z_1 \end{bmatrix} \xi +
\begin{bmatrix} x_3-x_1 \\ y_3-y_1 \\ z_3-z_1\end{bmatrix} \eta
\qquad \mbox{with:} \quad \begin{cases} \xi > 0 \\ \eta > 0 \\ \xi+\eta < 1 \end{cases}
$$
And quite in general:
$$
\phi = \phi_1 + (\phi_2-\phi_1)\,\xi + (\phi_3-\phi_1)\,\eta
$$
From this reference we infer that:
$$
\begin{cases}
 \xi  = [ (y_3 - y_1).(x - x_1) - (x_3 - x_1).(y - y_1) ] / \Delta  \\
 \eta = [ (x_2 - x_1).(y - y_1) - (y_2 - y_1).(x - x_1) ] / \Delta
\end{cases}
$$
Where $\Delta$ is twice the area of a triangle.
The Finite Element shape functions thus are, still for one triangle:
$$
N_1 = 1-\xi-\eta \quad ; \quad N_2 = \xi \quad ; \quad N_3 = \eta
$$ $$
x = N_1x_1+N_2x_2+N_3x_3 \\
y = N_1y_1+N_2y_2+N_3y_3 \\
z = N_1z_1+N_2z_2+N_3z_3 \\
\phi = N_1\phi_1+N_2\phi_2+N_3\phi_3
$$
Now specify for the 6 triangles in you mesh and you're done, for $\,\xi = \eta = 0\,$ eventually:


*

*$(1)\rightarrow(17) \;,\; (2)\rightarrow(11) \;,\; (3)\rightarrow(12)$

*$(1)\rightarrow(17) \;,\; (2)\rightarrow(12) \;,\; (3)\rightarrow(13)$

*$(1)\rightarrow(17) \;,\; (2)\rightarrow(13) \;,\; (3)\rightarrow(14)$

*$(1)\rightarrow(17) \;,\; (2)\rightarrow(14) \;,\; (3)\rightarrow(15)$

*$(1)\rightarrow(17) \;,\; (2)\rightarrow(15) \;,\; (3)\rightarrow(16)$

*$(1)\rightarrow(17) \;,\; (2)\rightarrow(16) \;,\; (3)\rightarrow(11)$
