Wikipedia:Reference desk/Archives/Mathematics/2008 June 30

Mathematics desk
< June 29 << May | June | Jul >> July 1 >
Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


June 30

edit

point inside tetrahedron

edit

Quick before its too late - a question.

Is there a very easy way to determine if a point lies inside an irregular tetrahedron defined by its four points?87.102.86.73 (talk) 23:58, 30 June 2008 (UTC)[reply]

Yes. Call your test point P. For each face, view it from the outside and label the points A, B, C in counter-clockwise (right-hand) order.  . Now if   then the point is outside the tetrahedron. If the point doesn't test outside for any of the faces, then it is inside or on the surface (I think you can figure out that edge case). --Prestidigitator (talk) 01:44, 1 July 2008 (UTC)[reply]
Yes cross product and dot products -that's the simplest I could find. Easier than solving for the scalars in the expression P=A + pAB +qAC +rAD where AB is the vector from A to B etc87.102.86.73 (talk) 09:47, 1 July 2008 (UTC)[reply]
Thank you very much.87.102.86.73 (talk) 09:55, 1 July 2008 (UTC)[reply]

It's not necessarily easy to define 'outside' and 'counterclockwise' for any given four points, esp. when you need to implement the calculations in some automatic routine like a computer program. The more general method would be to calculate similar expressions for the tetrahedron's fourth point and your test point and compare their signs:

  • name any of four given points D, then name remaining three A, B and C;
  • calculate vectors  
  • calculate vector   (perpendicular to the ABC plane) and verify if   and   are both positive or both negative – if so, points P and D are at the same side of ABC plane, otherwise they are at opposite sides.

Repeat calculations, having each vertex as D — a tertrahedron is a common part (intersection) of four half-spaces, so four positive results give you a positive answer to your question. --CiaPan (talk) 12:22, 1 July 2008 (UTC)[reply]

Nice touch.. but I don't really agree with It's not necessarily easy to define 'outside' and 'counterclockwise' for any given four points - it is quite easy for 4 points.. (if I ignore the rotation... and noting the possibility of an 'inverted tetrahedron')
(ABC,BCD,BDA,CAD are one such set - I hope - it is tricky)
note I'd calculate the 4 cross product vectors, and the 4 dot products.. I only note the sign of the dot products.. IF all 4 signs are the same then it's inside..
taken for a general convex shell made up of triangles the method you describe will save me time of working that out, for a little extra work later on.. Thanks.87.102.86.73 (talk) 23:03, 1 July 2008 (UTC)[reply]