#!/usr/bin/perl # $Id:$ # # This script draws a code wheel to glue to the edge of the # shutter, for an optical encoder. It draws it in FIG format, # for Xfig. print "#FIG 3.2 Landscape Center Inches Letter 100.00 Single -2 1200 2 "; $numlines=300; $cx=5; # center coords, in inches $cy=5; $or=2.050; # outer radius $ir=$or-0.0625; # inner radius $pi=3.14159263; $cx*=1200; $cy*=1200; $ir*=1200; $or*=1200; for($i=0;$i<$numlines;$i++) { print "2 3 0 0 0 0 50 0 20 0.000 0 0 -1 0 0 5\n"; $angle1=$i*2* ( (2*$pi)/($numlines*2)); $angle2=($i*2+1)* ( (2*$pi)/($numlines*2)); $x1=int(sin($angle1)*$ir+$cx); $y1=int(cos($angle1)*$ir+$cy); $x2=int(sin($angle1)*$or+$cx); $y2=int(cos($angle1)*$or+$cy); $x3=int(sin($angle2)*$or+$cx); $y3=int(cos($angle2)*$or+$cy); $x4=int(sin($angle2)*$ir+$cx); $y4=int(cos($angle2)*$ir+$cy); print " $x1 $y1 $x2 $y2 $x3 $y3 $x4 $y4 $x1 $y1\n"; } print "\n";