Question

according to wiki viewing angle http://en.wikipedia.org/wiki/Angle_of_view

How to calculate this formula?

Formula

I'm try:

double d = 36D;
double f = 50D;

double fov = (d/ (2*f);
double a = 2 * Math.Atan(fov);

thought is correct. But the result is not correct! should give an answer 39.6

Was it helpful?

Solution

The result is correct; but C# returns it in radians, if you want degrees just convert

double d = 36D;
double f = 50D;

double fov = (d/ (2*f);
double a = 2 * Math.Atan(fov) * 180.0 / Math.PI; // <- 39.598...

OTHER TIPS

the result of atan is in radians. convert in degree

double d = 36D;
double f = 50D;

double fov = (d/ (2*f));
double at = ((2 * Math.Atan(fov))* 180) / Math.PI;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top