2DLightPathSimulator/LensSimulatorCore/Optical/Surface.cs

48 lines
1.7 KiB
C#
Raw Normal View History

2023-06-06 22:56:56 +00:00
using LensSimulatorCore.Shapes;
namespace LensSimulatorCore.Optical;
public abstract class Surface
{
protected Surface(Element parent)
{
Parent = parent;
}
public bool IsFront { get; set; }
protected int SideSign { get; set; }
//This is the sign for front or rear. 1 if it is the front, -1 if it is the rear.
protected double QuadraticSign;
/// <summary>
/// Parent Element of the Surface.
/// </summary>
public Element Parent { get; set; }
/// <summary>
/// All points go clockwise from the element centre.
/// </summary>
public List<Point> PolyLine { get; } = new();
/// <summary>
/// This function calculates the lines and points through a reflective element and applies this to the Ray given the glass properties.
/// </summary>
/// <param name="sign">This defines if it is the front or rear surface, -1 if it is the front, 1 if it is the rear.</param>
/// <param name="ray">The Ray that will contain the results</param>
public virtual void Calculate(int sign, Ray ray) { }
/// <summary>
/// This function calculates the lines and points through a refractive element and applies this to the Ray given the glass properties.
/// </summary>
/// <param name="hitPosition"></param>
/// <param name="ray">This is the Ray that will contain the results</param>
/// <param name="sellmeierCoefficients">Sellmeier Coefficients</param>
public virtual void Calculate(Point hitPosition, Ray ray, SellmeierCoefficients sellmeierCoefficients) { }
//Functions
public abstract Point FindIntersection(PointVector pointVector);
public abstract void UpdateSurfacePositions();
public abstract void GeneratePolyLine();
}