2 # takes spot function and builds an ordered dither 8x8 matrix
4 my $func = shift or die "Usage: $0 function [width height expandx expandy]\n";
5 my $width = shift || 8;
6 my $height = shift || 8;
8 for my $y (0..$height-1) {
9 for my $x (0..$width-1) {
11 $spot[$x+$y*$width] = $res * $res;
15 @sp[sort { $spot[$a] <=> $spot[$b] } (0.. $#spot)] = 0..$#spot;
18 print " ",map(sprintf("%4d,", 4*$_), splice(@sp, 0, $width)),"\n";
23 my $min = shift @data;
25 $min = $_ if $_ < $min;
32 return ($x1-$x)*($x1-$x) + ($y1-$y)*($y1-$y);
38 return atan2($y1-$y, $x1-$x);
43 dist($x1, $y1)+theta($x1,$y1)/20;