Generate the fix radius circles within a specific area

1 view (last 30 days)
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?

Accepted Answer

KSSV
KSSV on 16 Jul 2021
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

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!