# Tetrahedron: Signed distance between circumcenter and face

In a triangle, the signed distance between the edge $e_1$ and the circumcenter of the triangle can be written as $$d_1 = \frac{\langle e_2, e_3\rangle}{\langle e_1\times e_2, e_1\times e_3\rangle}\cdot \frac{1}{2}\|e_2\times e_3\| \cdot \|e_1\|$$ and equivalently the area enclosed by edge $e_1$ and the circumcenter (relative to the total triangle area) $$A_1 = \frac{1}{2}\frac{\langle e_1, e_1\rangle \cdot \langle e_2, e_3\rangle}{\langle e_1\times e_2, e_1\times e_3\rangle} = \frac{1}{2}\frac{\langle e_1, e_1\rangle \cdot \langle e_2, e_3\rangle}{\langle e_1, e_1\rangle \cdot \langle e_2, e_3\rangle - \langle e_1, e_2\rangle \cdot \langle e_1, e_3\rangle}$$ where $e_2$ and $e_3$ are the other edges. The sign of $d_1$ and $A_1$ is negative if and only if the triangle circumcenter is on the "outside" of the triangle with respect to the edge.

I need compute the same value(s) for a tetrahedron, i.e., the signed distance of its circumcenter to a face circumcenter (which is where the connection line meets the face perpendicularly), or the signed relative volume of face $f_1$ and the tetrahedron circumcenter. Right now, I'm doing a funny cross-product dance to find out what the sign $d$ should have, explicitly computing the tetrahedron circumcenter and the circumcenter of the face, then taking the distance $\|O-H\|$ and signing it accordingly.

Given the simple representation for triangles, I'm wondering if something like this exists for tetrahedra too. Any hints?

• You might look at "Insphere for Irregular Tetrahedron" in Mathematica SE. There are reference-links and calculations there (but the code is in Mathematica). Jul 14, 2016 at 0:02

If $H$ is the circumcenter of $BCD$, then: $$O=H+{\vec{CD}\times\vec{CB}\over|\vec{CD}\times\vec{CB}|}h.$$ In the same way, if $H'$ is the circumcenter of $ABC$, then: $$O=H'+{\vec{CB}\times\vec{CA}\over|\vec{CB}\times\vec{CA}|}h'.$$ By comparing these we get: $${\vec{CD}\times\vec{CB}\over|\vec{CD}\times\vec{CB}|}h= \vec{HH'}+{\vec{CB}\times\vec{CA}\over|\vec{CB}\times\vec{CA}|}h'.$$ To get rid of $h'$, dot multiply both sides by $\vec{CA}$, which is perpendicular to the last term: $${(\vec{CD}\times\vec{CB})\cdot\vec{CA}\over|\vec{CD}\times\vec{CB}|}h= \vec{HH'}\cdot\vec{CA},$$ whence you can get $h$. Of course you must supply explicit formulae for $H$ and $H'$, but these can be derived from your formula for the triangle, or by repeating the above reasoning in the case of a triangle.

• Thanks! What's still unclear is if to take $\vec{CD}\times\vec{CB}$ or the other way around. I assume you've chosen the order looking at the picture, seeing that $A$ is "above" the $BCD$-plane, but when looking at the numbers only, nothing but a few cross products and if-thens tells you that. Or does it? Jul 14, 2016 at 18:10
• In the triple product, one vertex is repeated ($C$ in this case) and the other three are written in clockwise order as seen from $C$. Jul 14, 2016 at 18:58
• Yes, thanks. The question is how to figure out which is clockwise if not by looking at the picture. Jul 14, 2016 at 19:07
• You must supply that information when you define your tetrahedron, at least if it is given by the four vertices. If the tetrahedron is given by its six edges then I'm not sure, but I suspect you must anyway give some "spatial" info. Jul 14, 2016 at 19:16
• I have the four vertices at hand, no problem. Jul 14, 2016 at 19:22

Change in direction. Let's not be to cute.

Translate the tetrahedron such that one vertex is on the origin.

the three remaining vertexes are at

$\mathbf v_1 = (x_1,y_1,z_1),\mathbf v_2 = (x_2,y_2,z_2), \mathbf v_3 = (x_3,y_3,z_3)$

Find $\mathbf c = (x,y,z)$ such that $d(\mathbf v_1,\mathbf c) = d(\mathbf v_2, \mathbf c) = d(\mathbf v_3, \mathbf c) = d(\mathbf 0,\mathbf c)$

$2x_1 x + 2y_1 y + 2 z_1 z - (x_1^2 +y_1^2+z_1^2) = 2x_2 x+ 2y_2 y + 2 z_2 z - (x_2^2 +y_2^2+z_2^2) = 2x_3 x + 2y_3 y + 2 z_3 z - (x_3^2 +y_3^2+z_3^2) = 0$

And that is a simple system of linear equations.

$2x_1 x + 2y_1 y + 2 z_1 z = x_1^2 +y_1^2+z_1^2\\ 2x_2 x+ 2y_2 y + 2 z_2 z = x_2^2 +y_2^2+z_2^2\\ 2x_3 x + 2y_3 y + 2 z_3 z = x_3^2 +y_3^2+z_3^2\\$

• Thanks. Could you elaborate on how this helps finding $d$? Jul 13, 2016 at 17:35
• After thinking it through, my previous approach only worked for certain kinds of tetrahedra. This, though should work more generally. Jul 13, 2016 at 18:32
• Thanks again. So the equation system is for the circumcenter; nice! Finding that is also possible explicitly. (A combination of dot- and cross-products.) Jul 13, 2016 at 18:43

If we have a tetrahedron with the vertices $x_0$, $x_1$, $x_2$, $x_3$, let's consider the signed distance $d$ of the circumcenter to the face $x_0$, $x_1$, $x_2$. First, move the opposing vertex $x_3$ to the origin and call $A=x_0-x_3$, $B=x_1-x_3$, $C=x_1-x_3$.

The plane through $A$, $B$, $C$ is given by $$\langle (B-A) \times (C-A), X\rangle = \langle A\times B, C\rangle,$$ or, more symmetrically $$\langle A\times B + B\times C + C\times A, X\rangle = \langle A\times B, C\rangle \quad(=\langle B\times C, A\rangle = \langle C\times A, B\rangle).$$ Normalized, this will give a signed distance to the plane for any point $X$, $$\tilde{d} = \frac{\langle A\times B + B\times C + C\times A, X\rangle - \langle A\times B, C\rangle}{\|A\times B + B\times C + C\times A\|}.$$ We want to assert that $d$ is positive if and only if $X$ is on the same side of the plane as the origin ($x_3$), in other words: $d$ should have the same sign as $- \langle A\times B, C\rangle$. We can thus multiply with $-\langle A\times B, C\rangle/|\langle A\times B, C\rangle|$. Considering $|\langle A\times B, C\rangle|=6|\text{tet}|$ and $\|A\times B + B\times C + C\times A\|=2|\text{face}|$, we get $$d =\frac{1}{12\cdot|\text{tet}|\cdot|\text{face}|}(-\langle A\times B + B\times C + C\times A, X\rangle\langle A\times B, C\rangle + \langle A\times B, C\rangle^2).$$ Inserting the circumcenter $$O=\frac{(B\times C)\langle A, A\rangle + (C\times A)\langle B, B\rangle + (A\times B)\langle C, C\rangle}{2\langle A\times B, C\rangle}$$ for $X$ simplifies things a little further to $$d =\frac{1}{24\cdot|\text{tet}|\cdot|\text{face}|}(-\langle A\times B + B\times C + C\times A, (B\times C)\langle A, A\rangle + (C\times A)\langle B, B\rangle + (A\times B)\langle C, C\rangle\rangle + 2\langle A\times B, C\rangle^2).$$