简体   繁体   English

镜头的视角-C#

[英]Angle of View of a lens - C#

according to wiki viewing angle http://en.wikipedia.org/wiki/Angle_of_view 根据Wiki的视角http://en.wikipedia.org/wiki/Angle_of_view

How to calculate this 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 应该给出一个答案39.6

the result of atan is in radians. atan的结果是弧度。 convert in degree 转换度

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

double fov = (d/ (2*f));
double at = ((2 * Math.Atan(fov))* 180) / Math.PI;

The result is correct ; 结果是正确的 ; but C# returns it in radians , if you want degrees just convert 但是C#以弧度返回它,如果你想度数只转换

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM