VBA to check if object is inside or outside of freeform area

1.2k views Asked by At

I need help with this : I have Freeform area and shapes in form of circles named from A to G. Some of this points are inside of Freeform area and some of them no. I need macro which will check each of this points - if this point is inside/ outside of freeform area. How can i get result in form of table where in Column A are Names of shapes (circles-points) and in column B result (if point is inside/outside of freeform). Thanks Victor

Picture of what I need is here: enter image description here

1

There are 1 answers

0
Thomas Ludewig On

There are several ways to do that. Either over calculation of the Angles or by creating a ray trough the point and find the intersections To the polygons. If the count are even, it's inside; if it's odd it's outside. Those algorithms are not that trivial and numerical a challenge. Here are some links (They have vb6/vba source):

Paul Bourke Point inside Polygon

VB-Helper Point inside Polygon

If it has not that exact you may draw the points in a picturebox and determine the background color.

To find more search the web for "points inside polygon".