Re: Uniformly Distribute Points inside Polygon
- From: "Roger Stafford" <ellieandrogerxyzzy@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 5 Jun 2008 00:32:02 +0000 (UTC)
spiffyguy917@xxxxxxxxx wrote in message <15675137-8bde-4220-abea-
e9cc67b3694c@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>...
Hello..-----------
I'm looking for a way to uniformly distribute N points inside a convex
polygon made from X points... I'm working in matlab and right now I'm
just breaking the polygon up into a m x n (such that m*n = N) grid,
selecting the mid point of each box and checking to see if that point
is inside the polygon. I'm wondering if anyone knows a method to
distribute all the points with the polygon evenly..
Thanks!
I have the feeling John D'Errico will have an instant answer to this question,
but until he shows up, here are my thoughts. You should subdivide the
polygon up into triangles and select each triangle in proportion to its area.
Within a triangle you can uniformly distribute using two 'rand' calls. If P1 =
(x1,y1), P2 = (x2,y2), and P3 = (x3,y3) are the three vertices of the triangle,
then choose P = (x,y) according as
t = sqrt(rand); s = rand;
P = (1-t)*P1 + t*((1-s)*P2+s*P3)
Roger Stafford
.
- References:
- Uniformly Distribute Points inside Polygon
- From: spiffyguy917
- Uniformly Distribute Points inside Polygon
- Prev by Date: need help integrating the unit step function
- Next by Date: Re: Uniformly Distribute Points inside Polygon
- Previous by thread: Re: Uniformly Distribute Points inside Polygon
- Next by thread: Re: Uniformly Distribute Points inside Polygon
- Index(es):
Relevant Pages
|