# determining if a point existing with an area [Answered]RSS

## 1 reply

Last post Dec 08, 2008 09:08 PM by SGWellens

• sabrick

Member

16 Points

119 Posts

### determining if a point existing with an area

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.

• SGWellens

All-Star

124309 Points

10172 Posts

Moderator

### Re: determining if a point existing with an area

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.

Steve Wellens

My blog