diff options
Diffstat (limited to 'mkdlatbl.pl')
-rw-r--r-- | mkdlatbl.pl | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/mkdlatbl.pl b/mkdlatbl.pl new file mode 100644 index 0000000..a941d38 --- /dev/null +++ b/mkdlatbl.pl @@ -0,0 +1,58 @@ +#!/usr/bin/perl -w + +use POSIX 'round'; +$PI = 3.14159265358979; + +# bdeg means "binary degrees", 1/256 of a circle. +sub bdsin { + return sin($_[0] / 128 * $PI); +} + +sub bdcos { + return cos($_[0] / 128 * $PI); +} + +$centerx = 127; +$centery = 95; + +for $r (15, 30, 45, 75) { + push @xmin, $centerx - ($r + 10); + push @xmax, $centerx + ($r + 10); + push @ymin, $centery - ($r + 10); + push @ymax, $centery + ($r + 10); + for $angle (0..255) { + my $x = round($centerx + $r * bdcos($angle)); + my $y = round($centery + $r * bdsin($angle)); + push @xpoints, $x; + push @ypoints, $y; + } +} + +print "xmin:\n"; +for(@xmin) { + print " .byte $_\n"; +} + +print "xmax:\n"; +for(@xmax) { + print " .byte $_\n"; +} + +print "ymin:\n"; +for(@ymin) { + print " .byte $_\n"; +} + +print "ymax:\n"; +for(@ymax) { + print " .byte $_\n"; +} + +print "points_x:\n"; +for(@xpoints) { + print " .byte $_\n"; +} +print "points_y:\n"; +for(@ypoints) { + print " .byte $_\n"; +} |