Updated 2012-01-06 13:05:44 by dkf

Richard Suchenwirth 2007-06-12 - 'A figure used in many Asian cultures to symbolize the unity of the two "opposite" male and female elements, the "yin" and "yang."' [1] Here's a solution on a canvas with 4 arc items:

 package require Tk

 proc yinyang {w x0 y0 diameter {col1 black} {col2 white}} {
     set xm [expr {$x0 + $diameter/2.}]
     set ym [expr {$y0 + $diameter/2.}]
     set x1 [expr {$x0 + $diameter}]
     set y1 [expr {$y0 + $diameter}]
     set y2 [expr {$ym - $diameter/4.}]
     set y3 [expr {$ym + $diameter/4.}]
     $w create arc $x0 $y0 $x1 $y1 -start 0   -extent 180 -fill $col1
     $w create arc $x0 $y0 $x1 $y1 -start 180 -extent 180 -fill $col2
     $w create arc $x0 $y2 $xm $y3 -start 0   -extent 180 -fill $col2 -outline $col2
     $w create arc $xm $y2 $x1 $y3 -start 180 -extent 180 -fill $col1 -outline $col1
 }
#-- Test and demo:
 pack [canvas .c]
 yinyang .c 20 20 100 red blue

Not to nitpick.. but I'm going to nitpick:

There should be a red circle in the middle of the blue and a blue circle in the middle of the red.. symbolizing that nothing is pure. Also the orientation of the slices is usually vertical not horizontal, see e.g.: http://en.wikipedia.org/wiki/Yin_yang