46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using LensSimulatorCore.Shapes;
|
|
|
|
namespace LensSimulatorCore.Optical;
|
|
|
|
/// <summary>
|
|
/// A Ray contains a Wavelength, a list of hit points and a list of lines.
|
|
/// </summary>
|
|
public struct Ray
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="wavelength">Wavelength in µm</param>
|
|
/// <param name="angle">Angle in Radians</param>
|
|
/// <param name="startPosition"></param>
|
|
public Ray(double wavelength, double angle, Point startPosition)
|
|
{
|
|
Wavelength = wavelength;
|
|
Lines = new List<Line>();
|
|
PointVectors = new List<PointVector>();
|
|
|
|
Lines.Add(new Line(Math.Tan(-angle), startPosition.Y - (startPosition.X * Math.Tan(-angle))));
|
|
PointVectors.Add(new PointVector(startPosition, new Point(Math.Cos(-angle),Math.Sin(-angle))));
|
|
}
|
|
|
|
public double Wavelength { get; }
|
|
|
|
public List<Line> Lines { get; }
|
|
|
|
public List<PointVector> PointVectors { get; set; }
|
|
|
|
public ElementHit Cast(List<Element> elements)
|
|
{
|
|
List<Surface> allSurfaces = elements[0].Surfaces.ToList();
|
|
Point hitPosition;
|
|
ElementHit hit = new ElementHit();
|
|
|
|
foreach (Element element in elements)
|
|
{
|
|
|
|
}
|
|
|
|
return hit;
|
|
}
|
|
|
|
} |