blob: 37fb31b69f73aa8745f36258e0568b2cf43827aa (
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
59
60
61
62
63
|
#!/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 = 85;
$centery = 85;
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 "center_x = $centerx\n";
print "center_y = $centery\n";
print "xmin:\n";
for(@xmin) {
print " .byte $_\n";
}
print "xmax:\n";
for(@xmax) {
$_ = 169 if $_ >= 170;
print " .byte $_\n";
}
print "ymin:\n";
for(@ymin) {
print " .byte $_\n";
}
print "ymax:\n";
for(@ymax) {
$_ = 169 if $_ >= 170;
print " .byte $_\n";
}
print "points_x:\n";
for(@xpoints) {
print " .byte $_\n";
}
print "points_y:\n";
for(@ypoints) {
print " .byte $_\n";
}
|