• Advertisement
Sign in to follow this  

Find the altitude of an irregular tetrahedron given all 4 vertex positions

This topic is 832 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have an irregular tetrahedron using 4 vertices.

I need to find out the altitude given that one specific vertex is the top and the others are the base.

Basically the height would be the shortest distance from the top to its base creating a 90 degrees angle. It should be a simple math question but I cannot find anything on Google.

I am looking for an optimized function that looks like this :

float GetPyramidAltitude (Vector3 top, Vector3 baseA, Vector3 baseB, Vector3 baseC) { ... }

Thank you for your help.

 

Share this post


Link to post
Share on other sites
Advertisement
Pick the top vertex however you determine "top" (such as your first parameter in that function you have there).
If the other three vertices are coplanar (well, they're always coplanar, just make sure they're not degenerate into a point or line anyway) get the normal of the plane they lie on.
Take any edge from one base vertex to the top vertex and project that line onto the plane normal.
Take the magnitude of the resulting line.

Simplify and remove the unused portions of the calculation (i.e. the whole projected vector isn't needed, just the magnitude).

There are likely much simpler ways to do this that I don't know about since I'm not a math person, but that's an intuitive geometric way of going about it.

It seems like you could give a valid answer for the degenerate cases (all three base vertices at the same location | all base vertices collinear) as well:

- Point case: return the distance between top and any base vertex.
- Line case: solve the 3D problem the same way in 2D, just without the degenerate vertex (you can project along the base line and then subtract that from the top-base vector to get the vector along the "normal").

Early-out:
- If top is the same as any other vertex, return 0. Edited by Nypyren

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement