Presentation:
I created a class fotografia.cs that should be responsible for:
- Calculate the angle of view of the lens;
- Lens zoom (in mm)
- Receive the cut factor (value multiplied by the zoom of the lens shows the actual lens value)
- Camera sensor dimensions, etc.
I thought about creating the interface, more for academic purposes than practical.
Interface
namespace fotografia
{
public enum _CamerasFabricante { Canon=0, Nikon = 1, Sony = 2 };
public interface IFotografia
{
int CameraFabricante(_CamerasFabricante _value);
double FatordeCorte { get; set; }
int ObjetivaMM { get; set; }
double SensorHmm { get; set; }
double SensorVmm { get; set; }
double CalculoAnguloVisaoH();
double CalculoAnguloVisaoV();
}
}
I created the class for this interface:
using System;
namespace fotografia
{
internal class fotografia : IFotografia
{
public double FatordeCorte { get; set; }
public int ObjetivaMM { get; set; }
public int CameraFabricante(_CamerasFabricante _value)
{
return (int)_value;
}
private double _MMFinalObjetiva()
{
return (Convert.ToDouble(ObjetivaMM) * FatordeCorte);
}
public double SensorHmm
{
get;
set;
}
private double myVar;
public double SensorVmm
{
get { return myVar; }
set { myVar = value; }
}
public double CalculoAnguloVisaoH()
{
double fov = SensorHmm / (2 * _MMFinalObjetiva());
double arctan = 2 * Math.Atan(fov) * 180.0 / Math.PI;
return arctan;
}
private double CalculoAnguloVisaoV()
{
double fov = SensorVmm / (2 * _MMFinalObjetiva());
double arctan = 2 * Math.Atan(fov) * 180.0 / Math.PI;
return arctan;
}
}
}
Inquiries:
I'm calling it like this in the program
IFotografia ft = new fotografia();
ft.CameraFabricante(_CamerasFabricante.Canon);
ft.ObjetivaMM = 50;
ft.SensorHmm = 22.3;
ft.FatordeCorte = 1.6;
var t = ft.CalculoAnguloVisaoH();