% Parametric curve disc design ------------------------------------------

N = 900;  cN = exp((1:N)*pi*2j/(N-1));   % 900 point unit circle
a = .485;  b = 6.5;  cntr = complex(-.05,.16);  circ = .515*cN;  lm = [-1 1]*.54;
t0 = pi*(.303 : .002 : 1.5);   r0 = .6 ./ (t0.^.8);  p0 = r0.*exp(t0.*1j); % text spiral
t1 = pi*(a    : .001 : b  );   r1 =  1 ./  t1;       p1 = r1.*exp(t1.*1j); % red spiral
t2 = pi*(a+2  : .001 : b+2.7); r2 = 40 ./ (t2.^2);   p2 = r2.*exp(t2.*1j); % blue spiral
t3 = pi*(0:   .002 : 6   );  z = exp(t3.*1j) - 2.5 * exp(t3.*-2j/3);       % hypotrochoid
%
% Note: pltpub is part of the plt toolbox which is available on the Mathworks file exchange
%
l = pltpub(circ+cntr,p1,p2,z/100,'position',[8 8 840 840],'linewidth',{1 5 5 2},...
    'xy',[.01 .01 .99 .99],'Options','MenuTick',...
    'TraceC',[.7 .7 .7; 1 0 0; 0 0 1; 0 1 0],'xlim',real(cntr)+lm,'ylim',imag(cntr)+lm);
fig = gcf;

t1 = text(.0382,-.173,'r = 1/\theta',     'color',[1 0 0],'rotation',38);
t2 = text(.1028,-.26, 'r = 40/\theta^ ^2','color',[0 0 1],'rotation',43);
set([t1 t2],'fontname','Calibri','fontsize',20,'fontangle','italic');

e  = 'ENCINAL&EAGLE ULTIMATE';
%     E  N  C  I  N  A  L  &  E  A  G  L  E     U  L  T  I  M  A  T  E
en = [0 -2  0  0 -3  0  0  3  0  0  0  0  0  0  0  4  0  2 -4  0 -2  2]; % text position adjustments
es = [1  1  1  1  1  1  1 .6  1  1  1  1  1  1  1  1  1  1 .93 1  1  1]; % text size adjustments
ec = [3  3  3  3  3  3  3  2  1  1  1  1  1  2  2  2  2  2  2  2  2  2]; % text color
for k=1:length(e)
  m = 24*k-11;  v = es(k)*(p0(m+12) - p0(m-12));  m = m + en(k);  % text size & position
  c = [0 0 0];  c(ec(k)) = 1;  c(2) = 0;                          % text color
  if k==8 f = 'Arial'; else f = 'Lucida Handwriting'; end;        % different font for '&'
  text(real(p0(m)),imag(p0(m)),e(k),'color',c,'fontname',f,...    % create one character at a time
      'rotation',angle(v)*180/pi,'fontsize',780*abs(v));
end;

% 12 circles disc design ------------------------------------------
% note: This design is one solution to the problem below:
%
%      *****************************************************
%      **                                                 **
%      **            The 12 circle problem:               **
%      **    Draw 12 circles in a plane so that every     **
%      **    circle is tangent to exactly 5 others.       **
%      **                                                 **
%      *****************************************************
%
v = 1:4;  r = (12+5*v)./(12-v);      % radii of vertical set of 4
c = [v-1 complex(4,7-r) 9-v];        % center location of all 12 circles
r = [v r v];                         % radii of all 12 circles
g = [1 0 0; 0 .5 0; 0 0 1; .6 0 .6]; % colors for each group of 4 circles
cntr = complex(4,1.5);  circ = 6.5*cN;  lm = [-1 1]*6.8;
L = pltpub(circ+cntr, transpose(cN)*r + repmat(c,N,1),'TraceC',[.7 .7 .7; g; g; g],...
    'Options','TickMenu','LineWidth',5,'Position',[60 8 840 840],'Link',fig,...
    'Xlim',real(cntr)+lm,'Ylim',imag(cntr)+lm,'xy',[.01 .01 .99 .99],...
    'AxisPos',[1 1 1 1 1.2]);
m  = '2222222224220222' - '2';  m = [m m];  % position adjustments
s  = 'ENCINAL ULTIMATE  EAGLE ULTIMATE';  n = length(s);  t = 1:n/2;
q = 14*t;  q = m + mod([q-64 q+265],N);
for k=1:n
  p = .93*circ(q(k));  a = 90 + angle(p)*180/pi;  p = p + cntr;
  text(real(p),imag(p),s(k),'color',[0 0 0],'fontsize',34,'rotation',a,'fontname',f);
end;

% Congruent parts disc design -------------------------------------
% This design is a solution to the following puzzle:
%
%      ********************************************************
%      **                                                    **
%      **   Divide a circle into n congruent parts so that   **
%      **   at least one part does not touch the center.     **
%      **                                                    **
%      ********************************************************

N6 = N/6;  b = 1:6;  na = NaN+b;
i = repmat([3 4 5 6 1 2]*N6,N6,1);    % index points for arc centers
c = 1.015*cN;  d = c + c(i(:));       % N point circle with translated centers
e = [reshape(transpose(d),N6,6); na]; % insert NaNs to eliminate stray lines
b = [na; c(N6*b); d(N6*(b-.5))];      % draw the lines bisecting the 6 congruent parts
e = [e(:)' b(:)'];                    % append the bisecting lines to the 6 arcs
c = cN([895 4 146 153 296 302 446 452 596 603 746 752]);
e = [e NaN c(1:2) NaN c(3:4) NaN c(5:6) NaN c(7:8) NaN c(9:10) NaN c(11:12) NaN -.03 .03];
u = cumsum([1 repmat([1 1 1 1 1 0],1,180)]);  u(end) = [];  u(end) = N;
h = pltpub(cN*1.2,e,reshape(cN(u),6,180),'Pos',[120 8 840 840],'xy',[.01 .01 .99 .99],...
          'TraceC',[.7 .7 .7; .3 .3 .3; hsv(180)],'Link',fig,'Options',...
          'TicksMenu','linewidth',15,'Xlim',[-1.25 1.25],'Ylim',[-1.25 1.25]);
for k=1:n
  p = .173*circ(q(k));  a = 90 + angle(p)*180/pi;
  text(real(p),imag(p),s(k),'color',[0 0 0],'fontsize',34,'rotation',a,'fontname',f);
end;

set(findobj('marker','+'),'vis','off');
set([l(1) L(1) h(1)],'linewidth',1,'linestyle',':');