dividing a circle into equal n blocks and then generate one point inside each block

4 views (last 30 days)
how can I dividing a circle into equal n blocks and then generate only one point inside each block the circle radius is R and the blocks represent the users distribution inside the circle eg. if the circle radius 1 km and each block 1m by 1m (the border block may less than the block size)
If anyone can help me to do this, thanks in advance.
  4 Comments
Walter Roberson
Walter Roberson on 11 Mar 2017
What exactly is to happen at the border? Are the blocks to get smaller and smaller? Are you to use fixed-size blocks, but any block that has a presence inside the circle is to be allocated a point that must be inside the circle, thereby packing points closer together at the border?
Walter Roberson
Walter Roberson on 11 Mar 2017
Is the specification by length of the side of the blocks? or is the specification by number of blocks? Specifying by the number of blocks makes the calculation more difficult.
For example if the user specified that the circle of radius 1000 was to be divided into 57 square blocks, then it would not be possible to do that by dividing into squares in a way that was symmetric around the origin, as such a division would have at least 2-fold symmetry (typically more), which would leave you with an even number of blocks when an odd number was called for.
See http://www2.stetson.edu/~efriedma/squincir/ for examples of how complex it can be to optimally divide a circle into a fixed number of squares.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 10 Mar 2017
You cannot get exactly equal areas with any finite precision calculation system.
You can do "not so badly" by working in polar coordinates, and dividing up by angle.
sector_angle = 2*Pi/N;
rand_angle = ((0:N-1) + rand(1,N)) * sector_angle;
rand_rad = sqrt(rand(1,N)) * R; %sqrt compensates for area getting larger away from center
[rand_x, rand_y] = pol2cart(rand_angle, rand_rad);

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!