Inside, Outside or on the boundary of a Body?
Hi, I have domain of Fluid. I have descritized the domain into finite cells. I have put a body into the domain. The body has been descritized too which means that I have only some finite nodes instead of having the curve of the body. Now I select a random point in my domain. How can I find that this is inside, outside or on the boundary on my body?
What is the effective algorithm for finding that? Thank you in advance. 
Re: Inside, Outside or on the boundary of a Body?

Re: Inside, Outside or on the boundary of a Body?
You can use a simple ray test. For the point you want to check, extend a ray in any direction from the point (for example, ydirection). If you intersect the body surface only an odd number of times (e.g., 1 time), the point is inside the surface. If it is an even number of times (e.g., 0,2,...) then the point is outside the body.
A few caveats regarding this method: 1) This is only valid for closed bodies. If your body has holes or gaps, the raytest could fail. 2) The surface intersection check can be difficult in itself. Personally, I've used area comparisons (i.e., compare discretized panel area to same assuming point was inside panel). This type of method requires that you implement a tolerance (e.g., area_check  area_panel <= TOL). 3) The test can fail if the point lies right on the surface  you need to include a method for checking for this. An area check (i.e., 3D panel area vs. 3D area of panel nodes with point) can also be used for this. There are other methods also, I'm sure  the above just represents what I am using for my overset grid generation and solvers. The reference "Handbook of Grid Generation" (availabe from amazon.com) also has a short discussion in the overset grid section regarding these types of tests... Good luck! 
All times are GMT 4. The time now is 01:40. 