aboutsummaryrefslogtreecommitdiff
path: root/mkdlatbl.pl
blob: a941d384948706338e222e4e3d1878a5a13f7b84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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";
}