generating random , non uniform fiber distribution of circle in square

16 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Prodotti


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by