views:

159

answers:

1

The theory is this: I have a circle C of radius R and centre S. Inside this circle, I want to place N (a "big" number) points such that the density of points in the vicinity V of a point P is equal everywhere in the circle for all points. As N goes to infinity and the vicinity goes to P, the density function in both polar and cartesian coordinates becomes a constant.

So, how should I approach this if I wanted to populate the circle with N points of constant density?

+6  A: 

See Disk Point Picking. You generate a random theta (0 to 2*pi) and a random r (0 to 1), both distributed uniformly. The points would then be:

x = Sx + R*sqrt(r)*cos(theta)
y = Sy + R*sqrt(r)*sin(theta)

Another possibility is to generate points in the bounding square, and reject points that lie outside the circle.

Edit: This would make the probability density function constant in cartesian coordinates (which is probably what you want), but not in polar coordinates, since larger r would have higher probability. You can't have both of them be constant.

interjay
Great link - thanks!
Johann Gerell
interjay, you correctly realized that if its constant in one set of coordinates then its not in the other. This is a mathematical property, implying that the opening post is an ill-posed problem.
ldog
also, you should not generate the points in a square and reject to get constant density in cartesian co-ordinates. That screws with the random process, changing the density. Instead just choose random variable 0 <= X <= 1 and 0 <= Y <= sqrt(1-X^2)
ldog
oops should include the -1 <= X <= 1 and -sqrt(1-X^2) <= Y <= sqrt(1-X^2)
ldog
@gmatt, but then there would be higher density at the right and left sides (X near +/- 1) where Y would have a smaller range.
interjay