generating random , non uniform fiber distribution of circle in square

15 views (last 30 days)
I wanted to generate the square filled with circles of equal radius. Distribution should be random, non uniform and geomtrically periodic(meaning cut out portion of the circles on boundaries of square should be on the opposite side of the square). Though many people posted this question, no answer so far. can someone help me in it.
on esuggestion got to follow the Random sequential expansion(RSE) algorithm.

Accepted Answer

Adam Danz
Adam Danz on 20 Jan 2021
Edited: Adam Danz on 20 Jan 2021
Using bubblebath() from the file exchange (see another demo here),
figure('Color','w')
ax = axes();
axis off
S.axisHandle = ax;
S.frameSize = [100,100]; % axis size, centered at (0,0)
S.circSize = 2; % circle radius
S.nSizes = NaN;
S.edgeType = 2; % Frame should cut off circle edges
S.supressWarning = true;
S.drawFrame = true; % show the black axis frame
[circData, circHandles] = bubblebath(S);
% View the first 5 rows of circle (x,y) coordinates and radii
circData(1:5,:)
% ans =
% 29.88 -32.97 2
% 13.043 -30.441 2
% -45.91 1.8186 2
% 33.429 45.709 2
% 35.57 -19.943 2
  5 Comments
Adam Danz
Adam Danz on 22 Jan 2021
Edited: Adam Danz on 22 Jan 2021
@DIVAKAR RAJU P V download vs 2.3.0 of bubblebath(). This version supports edge wrapping. The section of circles that expand beyond an axis border are wrapped to the other side. If a circle expands beyond two axis borders at a corner, both its x and y components are wrapped. Note that this function relies on random processes and intentionally uses a low-level, unsophisticated algorithm which is different from circle-packing and its wrapping feature may differ from the algorithm in the paper you shared.
Example:
rng('default') % for reproducibility
S = struct();
S.frameSize = [30 30];
S.circSize = 4;
S.nSizes = NaN;
S.edgeType = 3; % <-- flag to wrap edges
S.supressWarning = true;
bubblebath(S)
Adam Danz
Adam Danz on 25 Jan 2021
Edited: Adam Danz on 26 Jan 2021
@DIVAKAR RAJU P V Have you tried to new version after I updated it for you and your question?

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!