I'm doing experiments where we have microscopic regular tetrahedrons moving around in a solution. We can detect and track the location of the 4 corners of the tetrahedron using some clever microscopy.
However, sometimes, one of the corners is not detected by our script. Based on the coordinates of the 3 detected corners, I should be able to tell where the final corner is on our coordinate grid, since I know the direction the missing point should be pointing relative to the remaining triangle from the previous successful tracking point.
Unfortunately, I have no clue how to get to the coordinates of the fourth corner from the XYZ coordinates of the 3 corners I know.
Can anyone help me out?
My question is almost an exact duplicate of this answer on stackoverflow.
Average your three points to get the center of the triangle:
$$center = (a + b + c) / 3$$
Calculate the normal vector by taking the cross product of two of the sides:
$$normal = (c - a) \times (b - a)$$
Normalize the normal vector (make it of unit length):
$$normal_{unit} = normal / |normal|$$
Scale the normal by the height of regular tetrahedron:
$$normal_{scaled}= normal_{unit}* \sqrt{2/3}$$
Now, your two points are:
$$top = center + normal_{scaled}$$ $$bottom = center - normal_{scaled}$$