2DLightPathSimulator/LensSimulatorCore/Optical/SellmeierCoefficients.cs

35 lines
1.0 KiB
C#

namespace LensSimulatorCore.Optical;
public struct SellmeierCoefficients
{
double _B1, _B2, _B3, _C1, _C2, _C3;
public SellmeierCoefficients(double B1, double C1, double B2, double C2, double B3, double C3)
{
_B1 = B1;
_B2 = B2;
_B3 = B3;
_C1 = C1;
_C2 = C2;
_C3 = C3;
}
public double CalculateRefractiveIndex(double Wavelength)
{
double wavelenths2 = Math.Pow(Wavelength, 2);
double A1 = _C1 != 0 ? _B1 / (1 - _C1 / wavelenths2) : 0;
double A2 = _C2 != 0 ? _B2 / (1 - _C2 / wavelenths2) : 0;
double A3 = _C3 != 0 ? _B3 / (1 - _C3 / wavelenths2) : 0;
return Math.Sqrt(1 + A1 + A2 + A3);
}
public double AirRefractiveIndex(double Wavelength)
{
double wavelenths2 = Math.Pow(Wavelength, 2);
double A1 = 238.0185 != 0 ? 0.05792105 / (1 - 238.0185 / wavelenths2) : 0;
double A2 = 57.362 != 0 ? 0.00167917 / (1 - 57.362 / wavelenths2) : 0;
return Math.Sqrt(1 + A1 + A2);
}
}