So, this is the kind of thing you only have to do twice before it's safer and easier to offload the entire calculation off to the computer.
#! usr/bin/perl
# a formula used to calculate size of "signal word" for Cdn cautionary copy.
# Find diameter of a circle with an area equal to 3% of the PDP.
# That's how big any required symbol needs to be.
# The signal word then has to be 1/4 that size.
use Math::Complex;
use constant PI => 4 * atan2(1, 1);
print "enter the X dimension of your PDP in centimeters\n";
my $xDim = (<\STDIN\>);
print "enter the y dimension of your PDP in centimeters\n";
my $yDim = (<\STDIN\>);
my $PDPArea = $xDim * $yDim;
my $SignalWordHeight = (sqrt(($PDPArea * .03)/PI))/2;
printf "the area of the principal display panel is %.3f cm square, and the signal word should be at least %.3f cm high.\n", $PDPArea, $SignalWordHeight;
Update: Had to escape "STDIN" with backslashes for Blogger. Remove before use.
No comments:
Post a Comment