primeLayout takes a positive integer p (the idea is for it to
be prime, though it doesn't really matter) and a diagram, and lays out
p rotated copies of the diagram in a circular pattern.
There is a special case for
p = 2: if the given diagram is
taller than it is wide, then the two copies will be placed beside each
other; if wider then tall, they will be placed one above the other.
The regular
p-gon connecting the centers of the laid-out
diagrams is also filled in with vertical bars of color representing
the number
p. In particular, there is one color for each
decimal digit (the provided list should have length 10 and represents
the digits 0-9), and the colors, read left to right, give the decimal
expansion of
p.
import Diagrams.TwoD.Factorization
plExample
= pad 1.1 . centerXY
. hsep 0.5
. map (sized (mkWidth 1))
$ [ primeLayout defaultColors 5 (circle 1 # fc black)
, primeLayout defaultColors 103 (square 1 # fc green # lw none)
, primeLayout (repeat white) 13 (circle 1 # lc orange)
]