determining if a point existing with an area RRS feed

  • Question

  • User-45435830 posted

    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.

    Monday, December 8, 2008 6:45 PM


  • User187056398 posted

    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.



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, December 8, 2008 9:08 PM