Skip to content
This repository has been archived by the owner on Oct 23, 2022. It is now read-only.

Allow for surface type extensibility in AxisymmetricOpticalSystem #179

Merged
merged 14 commits into from
May 13, 2021
Merged
7 changes: 6 additions & 1 deletion src/Examples/docs_examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@ function draw_zoomlenses(filenames::Vector{<:Union{Nothing,AbstractString}} = re
directions = Directions.Constant(0.0, 0.0, -1.0)
raygenerator = Sources.Source(; transform, origins, directions)

aspherics = [
[0, 0, 0, 1.0386E-04, 0, 1.4209E-07, 0, -8.8495E-09, 0, 1.2477E-10, 0, -1.0367E-12, 0, 3.6556E-15],
[0, 0, 0, 4.2721E-05, 0, 1.2484E-07, 0, 9.7079E-09, 0, -1.8444E-10, 0, 1.8644E-12, 0, -7.7975E-15],
[0, 0, 0, 1.1339E-04, 0, 4.8165E-07, 0, 1.8778E-08, 0, -5.7571E-10, 0, 8.9994E-12, 0, -4.6768E-14],
]
syss = [
AxisymmetricOpticalSystem{Float64}(DataFrame(
SurfaceType = ["Object", "Stop", "Standard", "Standard", "Standard", "Aspheric", "Standard", "Standard", "Aspheric", "Aspheric", "Standard", "Standard", "Standard", "Standard", "Standard", "Standard", "Image"],
Radius = [Inf64, Inf64, -1.6202203499676E+01, -4.8875855327468E+01, 1.5666614444619E+01, -4.2955326460481E+01, 1.0869565217391E+02, 2.3623907394283E+01, -1.6059097478722E+01, -4.2553191489362E+02, -3.5435861091425E+01, -1.4146272457208E+01, -2.5125628140704E+02, -2.2502250225023E+01, -1.0583130489999E+01, -4.4444444444444E+01, Inf64],
Parameters = [missing, missing, missing, missing, missing, [(4, 1.0386E-04), (6, 1.4209E-07), (8, -8.8495E-09), (10, 1.2477E-10), (12, -1.0367E-12), (14, 3.6556E-15)], missing, missing, [(4, 4.2721E-05), (6, 1.2484E-07), (8, 9.7079E-09), (10, -1.8444E-10), (12, 1.8644E-12), (14, -7.7975E-15)], [(4, 1.1339E-04), (6, 4.8165E-07), (8, 1.8778E-08), (10, -5.7571E-10), (12, 8.9994E-12), (14, -4.6768E-14)], missing, missing, missing, missing, missing, missing, missing],
alfredclwong marked this conversation as resolved.
Show resolved Hide resolved
Parameters = [missing, missing, missing, missing, missing, aspherics[1], missing, missing, aspherics[2], aspherics[3], missing, missing, missing, missing, missing, missing, missing],
Thickness = [Inf64, 0.0, 5.18, 0.10, 4.40, 0.16, 1.0, 4.96, zoom, 4.04, 1.35, 1.0, 2.80, 3.0, 1.22, dist, missing],
Material = [Air, Air, OHARA.S_LAH66, Air, NIKON.LLF6, Air, OHARA.S_TIH6, OHARA.S_FSL5, Air, OHARA.S_FSL5, Air, OHARA.S_LAL8, OHARA.S_FSL5, Air, OHARA.S_LAH66, Air, missing],
SemiDiameter = [Inf64, stop, 3.85433218451, 3.85433218451, 4.36304692871, 4.36304692871, 4.72505505439, 4.72505505439, 4.72505505439, 4.45240784026, 4.45240784026, 4.50974054117, 4.50974054117, 4.50974054117, 4.76271114409, 4.76271114409, 15.0]))
Expand Down
5 changes: 4 additions & 1 deletion src/Optical/OpticalSystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,10 @@ struct AxisymmetricOpticalSystem{T,C<:CSGOpticalSystem{T}} <: AbstractOpticalSys
elseif surface_type == "Aspheric"
semidiameter = convert(T, max(get_front_back_property(prescription, i, "SemiDiameter", zero(T))...))
frontconic, backconic = get_front_back_property(prescription, i, "Conic", zero(T))
frontaspherics, backaspherics = get_front_back_property(prescription, i, "Parameters")
frontparams, backparams = get_front_back_property(prescription, i, "Parameters", Vector{Float64}())
frontaspherics, backaspherics = [
[(i, p[i]) for i in 1:length(p) if p[i] != 0] for p in [frontparams, backparams]
]

newelement = AsphericLens(
material, vertices[i-1], frontradius, frontconic, frontaspherics, backradius, backconic,
Expand Down