One well-known symbol of the philosophy of duality known as yin and yang is the taijitu.



Task

   Create a function that, given a parameter representing size, generates such a symbol scaled to the requested size.
   Generate and display the symbol for two different (small) sizes.


R = 1;                      //outer radius of first image
scale = 0.5;                //scale of the second image
 
scf(0); clf();
set(gca(),'isoview','on');
xname('Yin and Yang');
 
//First one
n_p = 100;                  //number of points per arc
angles = [];                //angles for each arc
angles = linspace(%pi/2, 3*%pi/2, n_p);
Arcs = zeros(7,n_p);
 
    Arcs(1,:) = R * exp(%i * angles);
    plot2d(real(Arcs(1,:)),imag(Arcs(1,:)));
    line = gce();
    set(line.children,'polyline_style',5);
    set(line.children,'foreground',8);
 
    Arcs(2,:) = -%i*R/2 + R/2 * exp(%i * angles);
    plot2d(real(Arcs(2,:)),imag(Arcs(2,:)));
    line = gce();
    set(line.children,'polyline_style',5);
 
angles = [];
angles = linspace(-%pi/2, %pi/2, n_p);
 
    Arcs(3,:) = R * exp(%i * angles);
    plot2d(real(Arcs(3,:)), imag(Arcs(3,:)));
    line = gce();
    set(line.children,'polyline_style',5);
 
    Arcs(4,:) = %i*R/2 + R/2 * exp(%i * angles);
    plot2d(real(Arcs(4,:)),imag(Arcs(4,:)));
    line = gce();
    set(line.children,'polyline_style',5);
    set(line.children,'foreground',8);
 
angles = [];
angles = linspace(0, 2*%pi, n_p);
 
    Arcs(5,:) = %i*R/2 + R/8 * exp(%i * angles);
    plot2d(real(Arcs(5,:)),imag(Arcs(5,:)));
    line = gce();
    set(line.children,'polyline_style',5);
 
    Arcs(6,:) = -%i*R/2 + R/8 * exp(%i * angles);
    plot2d(real(Arcs(6,:)),imag(Arcs(6,:)));
    line = gce();
    set(line.children,'polyline_style',5);
    set(line.children,'foreground',8);
 
    Arcs(7,:) = R * exp(%i * angles);
    plot2d(real(Arcs(7,:)),imag(Arcs(7,:)));
    set(gca(),'axes_visible',['off','off','off']);
 
//Scaling
new_pos = R + 2*R*scale;
Arcs = new_pos + Arcs .* scale;
 
    plot2d(real(Arcs(1,:)),imag(Arcs(1,:)));
    line = gce();
    set(line.children,'polyline_style',5);
    set(line.children,'foreground',8);
 
    plot2d(real(Arcs(2,:)),imag(Arcs(2,:)));
    line = gce();
    set(line.children,'polyline_style',5);
 
    plot2d(real(Arcs(3,:)), imag(Arcs(3,:)));
    line = gce();
    set(line.children,'polyline_style',5);
 
    plot2d(real(Arcs(4,:)),imag(Arcs(4,:)));
    line = gce();
    set(line.children,'polyline_style',5);
    set(line.children,'foreground',8);
 
    plot2d(real(Arcs(5,:)),imag(Arcs(5,:)));
    line = gce();
    set(line.children,'polyline_style',5);
 
    plot2d(real(Arcs(6,:)),imag(Arcs(6,:)));
    line = gce();
    set(line.children,'polyline_style',5);
    set(line.children,'foreground',8);
 
    plot2d(real(Arcs(7,:)),imag(Arcs(7,:)));
    set(gca(),'axes_visible',['off','off','off']);