Question: Does anyone Have a function to check if a point is in a polygon
Q) I need to do a point-in-polygon function for a project I'm working on. Is this possible in Falconview? Thanks!!
-- EricBader? - 11 Jun 2007
Environment
| FalconView Version: | unspecified |
| Interface: | ILayer |
| Language: | Visual C++, C# VS 2003, C# VS 2005, Visual Basic, Visual Basic.Net, Java, C++.Net |
-- Main.ChrisBailey - 12 Jun 2007
Answer
I'm not sure what is your particular application here, but there is a simple, somewhat inefficient, algorithm for doing this that should suit your general purpose. The general idea is to take your point and drag it along a line out to infinity. If it crosses your polygon boundaries an odd number of times, it was inside the polygon. If it crosses zero or an even number of times, it was outside of the polygon. Optimize this general solution to suit your needs. -- Joel Odom
