Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Math, circles, interior points and densities [closed]

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?

like image 485
Johann Gerell Avatar asked Dec 02 '25 03:12

Johann Gerell


1 Answers

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.

like image 61
interjay Avatar answered Dec 04 '25 21:12

interjay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!