문제

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

도움이 되었습니까?

해결책

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...

다른 팁

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;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top