#include #include #define PI 3.141592653589793 #define TORAD(a) ( (a)*PI/180.0 ) /* Convert degrees to radians */ #define TODEG(a) ( (a)*180.0/PI ) /* Convert radians to degrees */ main( int argc, char *argv[] ) { float viewx, viewy ; float sizex, sizey ; // info fprintf(stderr, "\n viewsize, utility to calculate camera view angle \n" ); // get size: fprintf ( stderr, " Enter resolution [720x576] : "); scanf("%fx%f" , &sizex , &sizey ); // get angle: fprintf ( stderr, " Enter horizontal viewing angle : " ); scanf("%f" , &viewx ); // calculate vertical angle viewy = TODEG ( 2* atan( sizey / sizex * tan( TORAD(viewx)/2 ) ) ); fprintf ( stderr, " %fx%f , horizontal view is %f degrees\n" , sizex, sizey, viewx ); fprintf ( stderr, " Vertical view angle is : %.03f \n" , viewy ); }