Math, circles, interior points and densities

algorithm, math, random

Solution

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.

Problem

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?

Original source