Guilloche Pattern

Arjen Markus (28 march 2013) Spirographs and related curves have remarkable esthetic qualities. Here is a simple program to create one type of Guilloche patterns. It is little more than a transcription of a Mathematica program, but still. Play around with the parameters to see what variations are possible.

The program belows produces this picture:

Guilloche picture

# guilloche.tcl --
#     Sample program to draw a Guilloche pattern
#     - inspired by Mathworld, sample program in Mathematica
#     found at www.maa.org/editorial/mathgames/mathgames_02_09_04.html
#

package require Plotchart

proc guilloche {widget a b c d e f} {

    set p [::Plotchart::createPolarplot $widget {20 10}]

    $widget delete all

    set pi [expr {acos(-1.0)}]

    for {set phase 0} {$phase < 20}  {incr phase} {
        for {set m 0} {$m <= 200} {incr m} {
            set x [expr {$m * 2.0 * $pi / 200.0}]

            set y [expr {($c + sin($a*$x+$d)) + (($b + sin($b*$x + $e)) - ($c + sin($a*$x+$d))) * ($f + sin($a*$x + $phase/$pi))/2.0}]

            $p plot data$phase $y [expr {$x * 180.0 / $pi}]
        }
    }
}

pack [canvas .c -width 500 -height 500]
guilloche .c 4.0 8.0 30.0 4.7 1.8 1.0