Mathematics, circles, interior points and densities

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

So, how do I approach this if I would like to fill the circle N with points of constant density?

+3
source share
1 answer

See Selecting a disk point . You generate random theta (0 to 2 * pi) and random r (0 to 1) that are evenly distributed. Then the points will be as follows:

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

Another possibility is to create points in the bounding box and discard points that lie outside the circle.

Edit: this would make the probability density function constant in Cartesian coordinates (which you probably want), but not in polar coordinates, since a large r would have a higher probability. You cannot have both of them permanent.

+6
source

Source: https://habr.com/ru/post/1727949/


All Articles