Fun With Perl And Povray. There is very little in the obfusticated perl category here, but a lot of "fun" and "prettiness". This is what you get if you combine perl + l-systems + povray.... A mad fractal plumber in the sky.... (Requires Povray3.1 from www.povray.org) (If you don't feel like installing povray, you can see the result at http://www.geocities.com/SoHo/Cafe/5947/lurd.html) ====================================================================== %replacement = ( 'l' => 'ldflubl', 'r' => 'rburfdr', 'u' => 'ulbufru', 'd' => 'dfldbrd', 'f' => 'flufrdf', 'b' => 'bldbrub'); sub draw($$) { my( $cmd, $scale) = @_; my( $x, $y, $z) = (0,0,0); my( $r) = $scale / 5; for( $i = 0; $i < length( $cmd); $i++) { my $cyl = substr( $cmd, $i, 1); print OUTF "sphere {<$x,$y,$z>,$r}\ncylinder { <$x, $y, $z>, "; if( $cyl eq 'l') { $x -= $scale; } elsif( $cyl eq 'r') { $x += $scale; } elsif( $cyl eq 'u') { $y += $scale; } elsif( $cyl eq 'd') { $y -= $scale; } elsif( $cyl eq 'f') { $z += $scale; } elsif( $cyl eq 'b') { $z -= $scale; } else { die "Unregcognised draw cmd $cyl"; } print OUTF "<$x, $y, $z>, $r}\n"; } } sub recurse($$) { my( $name, $scale) = @_; if( $scale <= 0.2) { draw( $name, $scale); return; } $name =~ s{([lrfbud])}{$replacement{$1}}ge; recurse( $name, $scale / 3); } open( OUTF, ">lurd.pov"); print OUTF <<EOPOV; #include "colors.inc" #include "skies.inc" #default { pigment { Green} finish { ambient 0.3 diffuse 0.6 phong 1 } } sky_sphere { S_Cloud1} camera {location <-1,1,-2> look_at <-0.5,0.6,0.3>} light_source { <1,3,-5> color White} EOPOV recurse( 'lurd', 1); close OUTF; ====================================================================== John Carter <ece@dwaf-hri.pwv.gov.za> Telephone : 27-12-808-0374x194 Fax:- 27-12-808-0338 Cell : 083-543-6915 <http://www.geocities.com/SoHo/Cafe/5947> or <http://iwqs.pwv.gov.za> When I grow up, I'm going to be a range of mountains! ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe