The good news: it can be done. The bad news: A precise test is computationally expensive and therefore probably too slow to be of any use in real time rendering.

First off, it works only on convex objects. Concave objects would have to be broken down into two or more convex objects and then tested individually.

http://en.wikipedia.org/wiki/Concave_polygon[^]

Let's call the point you want to test P, the verices of the object VX and their normals NX. Then you will have to compute the cross product between the NX and (VX - P). The cross product will tell you wether P is inside the object or not and this must be true for every VX of the object.

Seriously, you are probably trying to program a collision test for some 3D engine, right? In this case The test is usually done against a much simpler object as a substitute for the real 3D object, usually those are boxes or spheres which approximate the space filled by the real 3D object and are far easier to test. It's very common in graphics to sacrifice some precision in order to gain performance.

12,400,556 members (63,805 online)

Email

Password

Sign in using

http://www.softsurfer.com/Archive/algorithm_0104/algorithm_0104B.htm

i dont know if they will help but take a look at it.