Page 1 of 1

isInside()

Posted: Sat Oct 30, 2004 1:35 pm
by Antares
Is it possible to write a function that can determine if a certain coordinateis located inside an self-contained mesh?

I am currently thinking about a volume calulation script and this would be one of the prerequisites.

Or does somethign like this already exist? I have seachred the net a bit, but i havent found anything so far.

Thanx for your help

Posted: Sat Oct 30, 2004 6:43 pm
by z3r0_d
what would you do about quads?

[there isn't such a function already]

now, if the mesh is convex the point lies inside it iff it is behind all of the faces [lets just assume quads are represented as two triangles]

if the mesh isn't convex, it is likely the point is in front of some faces, but if it is inside the mesh they wouldn't be the nearer faces

I guess you could do something to traverse the faces, and see where the shilouettes are and check if the nearest faces to the point are facing towards it or away from it. This method would be slow though, you would be better off finding another solution to your problem
[and it was just the first method that came to mind]