generating random , non uniform fiber distribution of circle in square

16 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Adam Danz
Adam Danz am 20 Jan. 2021
Bearbeitet: Adam Danz am 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 Kommentare
Adam Danz
Adam Danz am 22 Jan. 2021
Bearbeitet: Adam Danz am 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 am 25 Jan. 2021
Bearbeitet: Adam Danz am 26 Jan. 2021
@DIVAKAR RAJU P V Have you tried to new version after I updated it for you and your question?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by