Given four points, verify if they form a Tetrahedron

3k Views Asked by At

As per the title, I've been requested to build a program that -given 4 points in space- determine if they form a 3D shape and if this is case to present it's volume.

For the volume part of the problem, I'm aware there's a formula based on the Determinant, but I'm kind of lost in the Tetrahedron verification part. For now, I have the empirical idea of verifying if the four points are in the same plane (which I'm not sure how to do yet) and if it is not the case to call it a valid Tetrahedron but I'm not sure if that's the proper way to do it.

Any advice would be greatly appreciated. Also, any reading reference/material would be of great help.

PS: By the way, there's no mention of a particular order in point input.

2

There are 2 best solutions below

0
On BEST ANSWER

Just tidying up loose ends from other answers/comments.

Suppose we let $\mathbf u$, $\mathbf v$, $\mathbf w$ denote three edges of the tetrahedon, say $\mathbf u = \overrightarrow{AB}$, $\mathbf v = \overrightarrow{AC}$, $\mathbf w = \overrightarrow{AD}$. Then you probably know that the volume of the tetrahedron is given by $$ \text{Volume} = \tfrac16 \, \big|\mathbf u ⋅ (\mathbf v × \mathbf w)\big| $$ The triple product can be calculated using a determinant -- maybe that's the determinant formula you referred to.

If this determinant is zero, it means that the three vectors $\mathbf u$, $\mathbf v$, $\mathbf w$ are coplanar (i.e. linearly dependent), which happens when the four points are coplanar.

So, the volume calculation and the tetrahedron test are one and the same thing. You just calculate the determinant, $D$. If $D=0$ (to within some tolerance), this means that the tetrahedron has collapsed into a plane; if $D \ne 0$, then $|D|/6$ gives you the volume.

0
On

Let the four points be $A, B, C, D$. Consider the vectors $AB$, $AC$, and $AD$. The four points lie in the same plane if and only if $\{AB, AC, AD\}$ is linearly dependent. Therefore, to test whether four points are the vertices of a (non-degenerate) tetrahedron, you just have to check that $\{AB, AC, AD\}$ is linearly independent.