Creating tetrahedra
I have this OpenSCAD code that creates tetrahedra by getting its points:
points = [
[ -2.0122000217437757, -3.421492767333985, 0.7705124013125892 ],
[ -2.0122000217437757, -1.663867092132569, 0.7705124013125892 ],
[ -3.7698256969451918, -1.663867092132569, 0.7705124013125892 ],
[ -3.7698256969451918, -3.421492767333985, 2.5281380765140056 ],
];
polyhedron(points = points, faces = [ [ 0, 1, 2 ], [ 0, 2, 3 ], [ 0, 3, 1 ], [ 1, 2, 3 ] ]);
A normal tetrahedron is like this:
Flat-like tetrahedron
Sometimes the created tetrahedron has a flat-like shape. Like this case:
points = [
[ -3.7698256969451918, -2.149131520738902, 0.7705124013125892 ],
[ -4.1405207892279385, -3.421492767333985, 2.5281380765140056 ],
[ -3.7698256969451918, -3.421492767333985, 1.8517894984488612 ],
[ -5.133763843782198, -1.663867092132569, 2.5281380765140056 ],
];
Question
What is the mathematics to check if flatness of a tetrahedron is larger than a certain threshold? CalculiX solver documentation mentions using of maximum ratio of Jacobian determinants. However I don't know how to actually compute it. Is there any simple mathematical approach?
Update: trying the solution
I just tried the solution provided by @Cesareo . It even works reliably for a very tiny tetrahedron like below whose volume is 0.0006922827322921379 i.e. very small, but it doesn't have a flat shape:
points = [
[3.15082539916039, 1.082423025369646, 0.10059582768553593],
[3.370528608560567, 1.082423025369646, 0.12474012629469303],
[3.370528608560567, 1.302126234769823, 0.2107923202216621],
[3.370528608560567, 1.082423025369646, 0.2107923202216621],
];
The above points create this tetrahedron that is not flat but its volume is 0.0006922827322921379 i.e. extremely small :




There are many ways to verify the flatness for a tetrahedron. Ones more computational costly than others. One of simple application is associated to the tetrahedron volume. A flat tetrahedron has low volume. The formula is quite simple. Given the tetrahedron $[A,B,C.D]$ we have
$$ V = |\frac 16\left(\vec{AB}\times \vec{AC}\right)\cdot\vec{AD}| $$
for the two examples presented in the question, the volumes are respectively
$0.904957$ (non flat) and $0.025041$ (flat).
Attached a MATHEMATICA script including a normalizing factor to cope with scales. The volume is divided by the possible maximum possible volume, so the measure factor is
$$ \rho_V = 80\frac{|\left(\vec{AB}\times \vec{AC}\right)\cdot\vec{AD}|}{(|\vec{AB}|+|\vec{CD}|)(|\vec{AC}|+|\vec{BD}|)(|\vec{AD}|+|\vec{BC}|)} $$
now if $\rho_V \lt 1$ the tetrahedron is considered flat.