If I have an array of points (x,y,z) and am given a single point (x,y,z), what code do I use to determine if that point resides within the shape defined by the array?
I am drawing a blank on this one...
I'm using C#
EDIT
Thanks for the responses guys, from the comments I have found this link (http://alienryderflex.com/polygon/) which explains the process quite well.
Thanks!
FYI:
bool pointInPolygon() {
int i, j=polySides-1 ;
boolean oddNodes=NO ;
for (i=0; i<polySides; i++) {
if (polyY[i]<y && polyY[j]>=y
|| polyY[j]<y && polyY[i]>=y) {
if (polyX[i]+(y-polyY[i])/(polyY[j]-polyY[i])*(polyX[j]-polyX[i])<x) {
oddNodes=!oddNodes; }}
j=i; }
return oddNodes; }
It'll need some work, but thats the guts of it.
Thanks again