Generate the fix radius circles within a specific area

1 次查看(过去 30 天)
I want to generate the random circle with fix radius within a specific area like 0<x<1 0<Y<1 and each generated circle must be checked with all previously generated circle to make sure there is no interference
the progream will be finished when there is no more room for new circle is any functions there can do this?

采纳的回答

KSSV
KSSV 2021-7-16
r = 0.1 ; % radius of circle
x = 0:2*r:1 ;
y = 0:2*r:1 ;
[X,Y] = meshgrid(x,y) ;
th = linspace(0,2*pi) ;
xc = r*cos(th) ; yc = r*sin(th) ;
figure
hold on
for i = 1:length(x)
for j = 1:length(y)
plot(X(i,j)+xc,Y(i,j)+yc) ;
end
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calendar 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by