Harmonographs and Lissajous Curves
Patterning can draw the curves produced by harmonographs and their undamped cousins, Lissajous figures.
lissajousdraws closed curves from one oscillator on each axis, with no damping.harmonographadds damping so the figure spirals inward.multi-harmonographsums several oscillators on each axis for richer, multi-pendulum forms.
The simplest Lissajous call takes a single ratio:
(lissajous 3)
This is equivalent to fx=1, fy=3, with other values at their defaults. Only the ratio between the x and y frequencies determines the shape of a Lissajous figure.
For explicit frequencies use:
(lissajous fx fy)
or the full sampling form:
(lissajous fx fy nopoints num-cycles)
Here nopoints is the number of samples drawn per x-axis cycle, and num-cycles is how many of those cycles to trace. One cycle is one period of the slowest x frequency.
(set-standard-colors)
(grid 4
(map
(fn [r]
(lissajous 1 r 300 2
{:stroke coral :stroke-weight 1.5}))
[2 3 4 5 5/2 7/3 8/5 9/4]))
Harmonographs
A harmonograph is the same idea, but each axis can decay over time. Pass separate damping values for x and y:
(harmonograph fx fy damp-x damp-y nopoints num-cycles)
With zero damping, a harmonograph matches the corresponding Lissajous curve.
Different damping on each axis distorts the spiral as it contracts, which is often closer to the behaviour of real pendulum machines.
(set-standard-colors)
(grid 3
(map
(fn [[dx dy]]
(harmonograph 5 6 dx dy 420 8
{:stroke dark-green :stroke-weight 1.5}))
[[0.01 0.01]
[0.01 0.03]
[0.03 0.01]]))
Multi-pendulum curves
When more than one oscillator drives each axis, use multi-harmonograph with a map of options:
(multi-harmonograph
{:x [{:freq 1 :amp 0.8 :damp 0.01}
{:freq 2 :amp 0.4 :damp 0.012}]
:y [{:freq 3 :amp 0.8 :damp 0.01}
{:freq 5 :amp 0.3 :damp 0.015}]
:nopoints 400
:num-cycles 8
:style {:stroke blue :stroke-weight 1}})
Each axis value is the sum of its oscillators at each moment in time. The result is still one [x y] point per sample, but the path becomes more complex and organic.
(set-standard-colors)
(multi-harmonograph
{:x [{:freq 1 :amp 0.8 :damp 0.012}
{:freq 2 :amp 0.35 :damp 0.015}]
:y [{:freq 3 :amp 0.8 :damp 0.01}
{:freq 5 :amp 0.25 :damp 0.018}]
:nopoints 420
:num-cycles 10
:style {:stroke magenta :stroke-weight 1.5}})
As with trochoids, the simple functions are built on a lower-level point generator. Use harmonograph-points when you want the raw point sequence.
Continue to HexGrid