So if given a particular point, say (0,3,4)
how can you prove it lies OUTSIDE or INSIDE a pyramid with 4 vertices, say A(0,2,0), B(2,0,0), C(0,2,2), D(2,2,2)? (i just made these numbers up.
help much appreciated!!!
So if given a particular point, say (0,3,4)
how can you prove it lies OUTSIDE or INSIDE a pyramid with 4 vertices, say A(0,2,0), B(2,0,0), C(0,2,2), D(2,2,2)? (i just made these numbers up.
help much appreciated!!!
Here is one way that will work-- doubtless there are others.
1. Find the equation of the plane through ABC in the form f(x,y,z) = ax + by + cz = 0. I'm guessing you know how to compute a, b, and c. If not, let us know.
2. Compute f(D). In your example, that is 2a +2b + 2c.
3. Compute f(P) where P is your point of interest. In your example, that is 0a + 3b + 4c.
4. If the numbers computed in steps 2 and 3 have the same sign, then P and D lie on the same side of the plane ABC, so P may be inside the tetrahedron. If they don't have the same sign, P is definitely outside the tetrahedron.
5. If P passes the test (f(P) and f(D) have the same sign), repeat steps 1-4 for the other three faces of the tetrahedron: ABD, ACD, and BCD. If P passes the test for all the faces, it is inside the tetrahedron. That's because the tetrahedron is convex and is the intersection of the four half-spaces formed by the bounding planes.