
Barycentric Coordinates
Given: a triangle with vertices $V_0$, $V_1$, $V_2$ and a point $P$ inside it. Find: three weights $(\alpha, \beta, \gamma)$ — the barycentric coordinates of $P$ — such that: $$P = \alpha V_0 + \beta V_1 + \gamma V_2, \quad \alpha + \beta + \gamma = 1$$ When $\alpha = 1$, $P$ is exactly at $V_0$. When all three are equal ($\frac{1}{3}$), $P$ is at the centroid. They interpolate smoothly in between — which makes them useful for texture mapping, point-in-triangle tests, and meshing algorithms. ...