An interpolation method used in computer graphics that is a way of calculating the [[Triangle Rasterization|Barycentric Coordinate Functions]] of a triangle for use in interpolating [[Depth Buffer|z values]].
Let there be a [[Triangle]] $\triangle PQR$ on the [[../Math/Planes|Plane]] $\mathbf{P}$ with a 2D triangle $\triangle P_{\text{2D}}Q_{\text{2D}}R_{\text{2D}}$ in the $XY$ plane.
![[../../00 Asset Bank/Pasted image 20250415162726.png|sepia]]
The second triangle is an [[../Math/Orthogonal|orthogonal]] projection of $\triangle PQR$ to the $XY$ plane.
Recall that the [[../Math/Planes|Plane]] $\mathbf{P}$ has the [[../Math/Normal Vector|Normal]] [[../Math/Vector|Vector]] $\vec m$ [[../Math/Parallel|Parallel]] to any [[Triangle Orientation|Orientation Vector]] of $\mathbf{P}$:
$\huge \vec m = \braket{a,b,c}$
Which constitutes a [[../Math/Planes#Normal Form|Normal Equation]] for the plane:
$\huge ax+by+cz=d $
We can solve for $d$ by plugging in a known point inside $\mathbf{P}$ into the equation, so we can pick $P$, $Q$, or $R$ arbritrarily.
$ \huge aP_{x}+bP_{y}+cP_{z} = d $
Using the [[../Math/Planes#Normal Form|Normal Equation]], we can take any [[Point]] $I$ in the $XY$ [[../Math/Planes|Plane]] and find its interpolated $z$ value.
$ \begin{align}
aI_{x} + bI_{y}+ cz &= aP_{x}+bP_{y}+cP_{z} \\
cz &= aP_{x}+bP_{y}+cP_{z} - aI_{x} - bI_{y} \\
z &= \frac{
a(P_{x}-I_{x}) + b(P_{y-I_{y}}) + cP_{z}
}{c} \\
\end{align}
$
Or alternatively:
$ \huge
z = \frac{1}{c}\mat{a\\b\\c} ^{\intercal} \pa{P-\mat{I_{x}\\I_{y}\\0}}
$
Where $^\intercal$ represents an [[../Math/Dot Product|Dot Product]].
$
$
In other words, projecting any point $I\in XY$ onto the plane $\mathbf{P}$ such that $\braket{I_{x},I_{y}} \mapsto \braket{I_{x},I_{y}, z}$.
Vertices: $P=\pa{15,45,-3}, Q=\pa{70,80,11}, R=(40,10,-10)$
Find the interpolated $z$ value at $40, 30$.