there's always one point, in such meetings, when everybody around the table seems to be spreading nonsense (things like "this database can handle 10k simultaneous connection, guaranteed" or "it is necessary that we use XML to store our data", or even "let's write it in Java").
at that point I (as most others do, I tend to believe) started sketching something on the noteblock. the sheets had small square blocks, so I initially went with something geometric.
after a while (and a lot of nonsense) I started drawing circles, and ended up playing with variations on the yin-yang theme (the tao circle, the tai chi, whatever you call it, I'm not a zen expert :-).
for some strange reason, I came home with the idea of producing something more beautiful than my handmade version on paper. so I enumerated my possibilities:
1) buy a compass, some good paper and a marker.
2) use some drawing software (CorelDRAW? AutoCAD? Sodipodi?)
neither of these were satisfying and/or easy, so I decided for:
3) write a little program to draw this for me!
and the choice was obvious. the morning after, the first thing I've done (in the first 20 minutes of just another boring workday) was tao.pl. I coded, I hacked, I ran it. I saw the result and it was good :-)
here you find the latest (re)incarnation of my 20-minutes script, beautified just a little for your viewing pleasure. a "proof of concept" page showing the produced images is at http://dada.perl.it/tao.html.
#!perl -w # note: should be saved as tao.pl use strict; use GD; use Getopt::Long; use vars qw( $PARTS $DIM $HELP ); GetOptions( 'parts=i' => \$PARTS, 'dimension=i' => \$DIM, 'help!' => \$HELP, ) or warn(qq(try "$0 --help"\n)), exit(1); if($HELP) { print usage(); exit(0); } $DIM ||= 500; $PARTS ||= 2; # zero is balance of powers anyway. my $arcw = $DIM/$PARTS; my $TAO = GD::Image->new($DIM, $DIM); my $yin = $TAO->colorAllocate(0x00, 0x00, 0x00); my $yang = $TAO->colorAllocate(0xFF, 0xFF, 0xFF); my @shade = (); foreach (0..$PARTS) { push(@shade, $TAO->colorAllocate( ( 255 * ($_+1) / ($PARTS+1) ) x 3 )); } $TAO->filledRectangle( 0, 0, $DIM, $DIM, $yang ); foreach my $arc (1..$PARTS) { $TAO->arc( ($arc*$arcw)/2, $DIM/2, $arc*$arcw, $arc*$arcw, 180, 0, $yin ); } foreach my $arc (1..$PARTS) { $TAO->arc( $DIM-($arc*$arcw)/2, $DIM/2, $arc*$arcw, $arc*$arcw, 0, 180, $yin ); } foreach my $arc (1..$PARTS-2) { $TAO->fill( $arcw/2+$arc*$arcw, $DIM/2, $shade[$arc-1] ); $TAO->arc( $arcw/2+$arc*$arcw, $DIM/2, $arcw/5, $arcw/5, 0, 360, $shade[$PARTS-$arc-1] ); $TAO->fill( $arcw/2+$arc*$arcw, $DIM/2, $shade[$PARTS-$arc-1] ); } $TAO->fill( $arcw/2-$arcw/5-2, $DIM/2, $yin ); $TAO->arc( $arcw/2, $DIM/2, $arcw/5+1, $arcw/5+1, 0, 360, $yang ); $TAO->fill( $arcw/2, $DIM/2, $yang ); $TAO->arc( $DIM-$arcw/2, $DIM/2, $arcw/5, $arcw/5, 0, 360, $yin ); $TAO->fill( $DIM-$arcw/2, $DIM/2, $yin ); open TAO, ">tao-$PARTS.png"; binmode TAO; print TAO $TAO->png(); close TAO; print "take a look at tao-$PARTS.png. have a nice day -- dada.\n"; sub usage { <<EOF; $0 (c) 2003 Aldo Calpini <dada\@perl.it> usage: $0 [OPTIONS] options: -d=N (--dimension=N) width and height, in pixels, of the resulting image. -p=N (--parts=N) number of parts (2 for a "regular" tao image). -h (--help) show this text. the defaults, if OPTIONS are not specified, are: -d=500 -p=2 output will be saved in "tao-N.png", where N is the value of the -p option. EOF }
update: removed some silliness (just realized that $x/($x/$y) is $y).
cheers,
Aldo
King of Laziness, Wizard of Impatience, Lord of Hubris
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: tao degradation
by abell (Chaplain) on Jun 27, 2003 at 19:31 UTC | |
Re: tao degradation
by Mr. Muskrat (Canon) on Jun 27, 2003 at 14:42 UTC | |
Re: tao degradation
by zentara (Archbishop) on Jun 27, 2003 at 17:32 UTC |