سؤال

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