How to make sure the order of a tetrahedron points is in a certain way

46 Views Asked by At

Tetrahedon points order

I'm going to create tetrahedra whose points should exactly be in a specific order like below:

Tetrahedron points order

Sample: OpenSCAD

For example, my points are logged using OpenSCAD like this:

for (i = [0:1:len(points) - 1])
{
    echo("points of ", i, "are ", points[i]);
}

The logs are:

ECHO: "points of ", 0, "are ", [[40, 0, 0], [0, 40, 0], [0, 0, 40], [0, 0, 80]]
ECHO: "points of ", 1, "are ", [[80, 0, 0], [0, 40, 0], [40, 0, 0], [0, 0, 80]]
ECHO: "points of ", 2, "are ", [[80, 0, 0], [0, 80, 0], [0, 40, 0], [0, 0, 80]]
ECHO: "points of ", 3, "are ", [[80, 0, 0], [80, 80, 0], [0, 80, 0], [0, 0, 80]]
ECHO: "points of ", 4, "are ", [[80, 0, 0], [80, 80, 0], [0, 0, 80], [80, 0, 80]]
ECHO: "points of ", 5, "are ", [[80, 80, 0], [0, 80, 0], [0, 0, 80], [0, 80, 80]]
ECHO: "points of ", 6, "are ", [[80, 80, 0], [0, 0, 80], [80, 0, 80], [80, 80, 80]]
ECHO: "points of ", 7, "are ", [[80, 80, 0], [0, 80, 80], [0, 0, 80], [80, 80, 80]]

With each four points, a tetrahedron is created by OpenSCAD polyhedron function:

polyhedron(points = points[0], faces = [ [ 0, 1, 2 ], [ 0, 2, 3 ], [ 0, 3, 1 ], [ 1, 2, 3 ] ]);

Question

How can I double-check whether the order of points are exactly like the above figure?

Jacobian matrix?

For double-checking order of points, can I compute the determinant of the Jacobian matrix for each tetrahedron? If it's non-positive, then the points order might be messed up. Would it be right? The Jacobian matrix can be computed like this:

https://stackoverflow.com/a/65829475/3405291

1

There are 1 best solutions below

1
On BEST ANSWER

You can compute the vector from $1\to 2$, the vector from $1\to 3$, and build the cross product. This cross product point into the space ``above'' the plane. To check that $1\to 4$ is in the same half-space, compute the angle between the cross product and that $1\to 4$. Actually the angle is not needed, just the sign, so it suffices to compute the dot product between these which is proportional to the cosine of the angle. This is basically the same reasoning as considering the sign of the jacobian matrix (which is the sign of the volume), but potentially slightly faster.