# Thread: Generate Points in Polygon

1. ## Generate Points in Polygon

Hey all!

I need to write a little application. My Basic Problem is i have a polygonal area which is not rectangular but isn't too complex as well, just a few vertex points building the polygonal area.

So, i need to place random starting points in this polygonal area. I googled and googled and of course found quite some stuff. Most interesting is the "Ray Casting Algorithm" from Point in polygon - Wikipedia, the free encyclopedia and other sources, but what bothers me is the fact that it's a test on a point if it's in or out the poly. But what if i want to generate points in the Polygon? do i generate random coordinates within a bounding box of the polygon and test them if they're in the poly and if they are, i actually create them?? This doesn't sound very effective to me..

Has anybody an idea or a hint on how to generate random coordinates within this polygonal area "directly"?

Thanks a lot for any help.

Cheers,
Poly

2. To be honest, I cannot say that I really follow what you are trying to do.
But if the polygon is convex the you may explore lines of support.
A convex polygon has all sides on the same side of a line of support.
I suggest that you do a search on the terms “convex” and “line of support”.
For a non-convex polygon, I think one would have to reduce it to convex sub-polygons.