Math::Curve::Hilbert - a Hilberts Curve perl module!

TeeJay on 2003-05-22T00:26:29

I just spent the whole evening drawing sketches and tables and algorithms for Hilberts curve!

The result being a CPAN ready module that I am uploading right this minute.

Once I got my head around it, it was very easy to implement in pure perl, even if I made it a little verbose so that I can still understand it next week.

Anyway Math::Curve::Hilbert version 0.01 is now available on CPAN and allows you to get a list of coordinates in the order of hilberts curve depending on the shape and direction of the curve you want to follow as well as the level of recurssion.

update Oopsie! there is a mistake in the pod - the starting X and Y should be references to numbers rather than numbers.

so you would use it like :

use Math::Curve::Hilbert qw(:all);
my ($startx,$starty) = (1,8);
my $coords = up ( clockwise=>1, level=>0, max=>2, X=>\$startx, Y=>$starty);