Sphere center from three tetrahedron face distances (source code)

= Sphere center from three tetrahedron face distances
{title2=$\mathbf p=r(|\mathbf b\times\mathbf c|\mathbf a+|\mathbf c\times\mathbf a|\mathbf b+|\mathbf a\times\mathbf b|\mathbf c)/\tau$}

For a positively oriented <basis> $\mathbf a,\mathbf b,\mathbf c$, put $\tau=\mathbf a\cdot(\mathbf b\times\mathbf c)>0$. The center of an interior <sphere> at distance $r$ from each of the three <tetrahedron> face planes through the origin has the displayed expression. The three inward <unit vectors> are the normalized <cross products> $\mathbf b\times\mathbf c$, $\mathbf c\times\mathbf a$, $\mathbf a\times\mathbf b$. Taking <inner products> with these vectors solves three independent signed-distance equations. Reversing some signs instead produces centers on exterior sides. Existence of a sphere contained in the full <tetrahedron> also requires clearance from the fourth face.