Symmetry Rendering

The construction

The visual effect in this project comes from drawing many rotational copies of a single curve. Given a complex-valued curve func(t) and a rotation angle θ, each copy is:

rotated_curve(t) = exp(im·θ) · func(t)

Multiplying by exp(im·θ) rotates every point on the curve by θ radians around the origin. Drawing n copies with θ evenly spaced over [0, 2π) produces an image with n-fold rotational symmetry.


drawfunc — plot a single curve

drawfunc(func, t; color=nothing)

Plots a single complex-valued curve. Useful for previewing a curve before committing to the full symmetry construction.

ArgumentDescription
funcAny function t -> ComplexF64
tParameter range, e.g. range(0, 2π, 1000)
colorOptional RGBA or HSLA color; random if omitted

Returns a Makie Figure.


drawZθfunc4b — the main renderer

fig, hist = drawZθfunc4b(func, t, ic, cf, cfs; n=8)

Draws n rotationally symmetric copies of func on a black background, with color evolving via the mycolor state machine.

Arguments

ArgumentTypeDescription
funcFunctionComplex-valued curve: t -> ComplexF64
tAbstractRangeParameter values to sample the curve at
icHSLAInitial color for the first trace
cfFunctionColor selector — always pass mycolor
cfsVectorColor configuration array (see Color System)
nIntNumber of rotational copies (default 8)

The n parameter

n controls how many copies of the curve are drawn, each rotated by 2π/n more than the previous.

nEffect
4–8Sparse, open structure — individual traces clearly visible
16–32Moderate density — overlapping traces form bands
64–128Dense, solid-looking rings or shapes
256+Very dense — the individual traces blend into smooth regions

For curves built with fkm(t, k, m, ...), setting n to a multiple of m ensures the copies tile perfectly to fill the symmetry.

The t parameter range

The sampling density affects how smooth each curve looks:

t = range(0, 2π, 500)   # coarser — faster, slightly jagged
t = range(0, 2π, 2000)  # finer — slower, smooth

For most curves, 1000 points is a good default. High-frequency fkm curves (large M) benefit from 2000–4000 points.

The ic (initial color) parameter

ic is the color used for the very first trace. After that, mycolor takes over. Good starting points:

drawZθfunc4b(func, t, chinese_red,    mycolor, cfs3; n=128)
drawZθfunc4b(func, t, cadmium_orange, mycolor, cfs2; n=128)
drawZθfunc4b(func, t, naples,         mycolor, cfs1; n=128)

Return values

drawZθfunc4b returns (fig, hist):

  • fig: the Makie Figure — display it or save it.
  • hist: a vector of [θ, color, cont] for each rotation step.
    • θ — the rotation angle for that step (radians)
    • color — the HSLA color used
    • cont — whether this step was a color continuation (true) or a jump (false)

The hist array is designed for animation: you can replay the drawing process step by step to produce a video. Each entry in hist is everything needed to redraw that one trace.


Typical usage pattern

using DigitalArt

# 1. Define the curve
cs = [1.0+0im, 0.5+0im, 0+im/3]
fs = [1.0, 6.0, -14.0]
func = t -> μg(t; cs=cs, fs=fs)

# 2. Sample it
t = range(0, 2π, 1000)

# 3. Draw with 128-fold symmetry
fig, hist = drawZθfunc4b(func, t, chinese_red, mycolor, cfs3; n=128)

# 4. Save
save("my_artwork.png", fig)

How curve shape and n interact

The visual character of the image is determined by both the curve and the number of rotations:

  • A simple curve (few terms, smooth) with low n → sparse floral pattern with clearly separated petals.
  • A complex curve (many terms, wiggly) with low n → a tangled, web-like structure.
  • A simple curve with high n → smooth, ring-like bands.
  • A complex curve with high n → dense, richly textured fills.

The effective "radius" of the image in plot units is approximately |cs[1]| + |cs[2]| + ... (sum of coefficient magnitudes). If the image is clipping the axes, either reduce the coefficients or adjust the axis limits.


Saving output

save("artwork.png", fig)   # raster image
save("artwork.pdf", fig)   # vector, good for print

CairoMakie is required for PDF output. GLMakie is faster for interactive preview but cannot produce PDF.