/* 
 * Field of view calculator by Eric Smestad <esmestad@hickorytech.net>
 * 11/24/2003
 * 
 * to compile run: 
 * gcc fovcalc.c -o fovcalc
 * 
 */

int main (int argc, char *argv[])
{
   float lnCCDWidth,lnCCDHeight,lnFL;
   float lnFOVW,lnFOVH;
   float lnConversion;
   lnConversion = 57.3;
   
   if ((argc < 2) || (argc == 3))
     {
	printf ("Usage: %s FL [W H]\nFL = Focal length of Lense/Telescope in mm\nW = Width of Film/CCD in mm (Default is 36)\nH = Height of Film/CCD in mm (Default is 24)\n",argv[0]);
	exit(0);
     }
   if (argc == 2)
     {
	lnCCDWidth = 36;
	lnCCDHeight = 24;
     } 
   else
     {
        lnCCDWidth = atoi(argv[2]);
	lnCCDHeight = atoi(argv[3]);
     }
   lnFL = atoi(argv[1]);
   
   printf ("FOV W = %f * (%f / %f)\n",lnConversion,lnCCDWidth,lnFL);
   printf ("FOV H = %f * (%f / %f)\n\n",lnConversion,lnCCDHeight,lnFL);
   
   lnFOVW = lnConversion * (lnCCDWidth / lnFL);
   lnFOVH = lnConversion * (lnCCDHeight / lnFL);
   
   printf ("Field of View Width: %f degrees\n",lnFOVW);
   printf ("Field of View Height: %f degrees\n",lnFOVH);
   
   exit(0);   
}

/* Note: Snow is like soft hail.. */

