Circles packed with Circle with defined radii

Hello, my teacher did this challenge:
I have 51 circles with radii from 1, 2, 3... 51. I need pack all them inside a big circle with radius 233, without overlap, and I need show it.
I started from some ideias, since the Apollonio Gasket, and from packomania, but I can't figure out how to set the cordinates x,y from center of the circles and they don't overlap!
From the packomania I found the best packing, the radius from big circle is 227, so my packing don't need have all circles touching
This is what I started:
R = 0;
r = [R];
n = 52; %number of circles
for i = 1:n
r(i) = R + i; %vector with all radii
end
r(52)= 233; %radius from the container circle
x = randi([-180 180],52,1); % random coordinates x
y = randi([-180 180],52,1); % random coordinates y
x(52,1) = 0; % coordinates from container circle
y(52,1) = 0; % coordinates from container circle
% transform some circles tangent to the container circle
for i = 1:2:31
x(i) = (-(y(i))^2 + r(i)^2 - 2*(r(i)*r(52))+ r(52)^2)^(1/2);
end
for i = 2:2:30
x(i) = -(-(y(i))^2 + r(i)^2 - 2*(r(i)*r(52))+ r(52)^2)^(1/2);
end
h = circle(x,y,r,n);
%function for plot circles
%function h = circle(x,y,r,n)
%hold on
%th = 0:pi/50:2*pi;
%for i = 1:n
%xunit = r (i).* cos(th) + x(i);
%yunit = r (i).* sin(th) + y(i);
%h = plot(xunit,yunit);
%end
%hold off

Answers (0)

Categories

Asked:

on 25 Nov 2018

Edited:

on 25 Nov 2018

Community Treasure Hunt

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

Start Hunting!