File: arm_calc.pl

package info (click to toggle)
xtux 0.2.010601-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 9,128 kB
  • ctags: 1,972
  • sloc: ansic: 11,330; makefile: 166; perl: 126; sh: 44
file content (24 lines) | stat: -rwxr-xr-x 414 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl

($width, $height, $swidth, $sheight) = @ARGV;
$pi = 3.14;

$yfact = 0.5;

$disx = $width / 2;
$disy = $height - $sheight;

foreach $i ( 0..7 ) {
	$_ = $i * 2 * ($pi / 8);
	$x = $swidth * cos;
	$y = $sheight * sin * $yfact;

	$arm1x = int( $x + $disx );
	$arm1y = int( $y + $disy );

	$arm2x = int( - $x + $disx );
	$arm2y = int( - $y + $disy );

	print "$i : $arm1x, $arm1y, $arm2x, $arm2y\n";
}