generating random , non uniform fiber distribution of circle in square

14 次查看(过去 30 天)
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.

采纳的回答

Adam Danz
Adam Danz 2021-1-20
编辑:Adam Danz 2021-1-20
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 个评论
Adam Danz
Adam Danz 2021-1-22
编辑:Adam Danz 2021-1-22
@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 2021-1-25
编辑:Adam Danz 2021-1-26
@DIVAKAR RAJU P V Have you tried to new version after I updated it for you and your question?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by