on 23 Oct 2021
% Script for drawing a gallery of Hypotrochoids, more commonly know as
% Sequence of inputs that compute different kinds of spirographs
% Normally I'd use R1, R2, R3 - but I needed to cut back on some
% Also, replaced spaces in array with ; so I could save the ' char
% needed to transpose these.
% Each input combo requires a different number of loops around before it
% reconnects with itself. Here are those sizes, but times 2pi to represent
% the loops as angles.
% These inputs m,n,p are intermediate values.
% Since A,B,C are column vectors, and colonop is a row vector, this makes
% a 2d matrix through scalar expansion. (Check out Loren's blog post
% about that.) What this means is that each row represents the computed
% coordinates of one loops and allows all the different shapes to be
% computed at the same time. This saves a few characters, as the
% alternative is to do this one shape at a time in a loop. The chars
% saved are the array subsref into A,B,C - or 3chars per variable
% occurance. (ie A instead of A(k) )
% Also, use colonop for m as it is shorter than linspace.
% Have colors expand out from the center.
% I wanted to save characters by skipping the call to tiledlayout, but in
% 'flow' mode I ended up with 2 columns instead of 3. This call to tiled
% layout was shorter than tweaking the figure size, and it let me change
% the padding to make the pictures bigger.
% Loop over each row and display it.
axis off equal
% Expensive character wise, but I think this colormap looks nice for these shapes.