Last post Dec 08, 2008 09:08 PM by SGWellens
Dec 08, 2008 06:45 PM|sabrick|LINK
Okay I admit this might not be an appropriate question for this board but here it goes:
I have a series of points on a graph (Each with a X and a Y)
These points make up some form of enclosed area.
I'm currently trying to find a way of detecting if some other point exists within that area enclosed by the points.
I have attached a illustration to help you understand my question:
As you can see, there is an enclosed area that is shaded red.
All icons inside the red shaded area are circles while all icons existing outside the shaded area are sqaures.
My question is "Given that I know only the points that make up the shaded area, how can I detect if a icon exists within it or outside of it?".
This is for a simple mapping program I'm currently writing.
Dec 08, 2008 09:08 PM|SGWellens|LINK
Make a new bitmap.
Use FillPolygon to color the region with a known color...say Blue.
Use GetPixel with the XY coordinates of the point and get the color of the pixel.
If it's Blue, it's inside the polygon.