Got real tracing, seidel calulations working
This commit is contained in:
@@ -11,6 +11,7 @@ module Petzval.Optics
|
||||
, ConstMat(..)
|
||||
-- * Optical elements
|
||||
, Element(..)
|
||||
, isStop, isSurface
|
||||
, thickness
|
||||
, outsideRadius
|
||||
, material
|
||||
@@ -64,6 +65,15 @@ data Element mat fp =
|
||||
}
|
||||
deriving (Show)
|
||||
makeLenses ''Element
|
||||
|
||||
-- | Determine if an element is a stop
|
||||
isStop :: Element mat a -> Bool
|
||||
isStop Stop{} = True
|
||||
isStop _ = False
|
||||
-- | Determine if an element is a refractive surface
|
||||
isSurface :: Element mat a -> Bool
|
||||
isSurface Surface{} = True
|
||||
isSurface _ = False
|
||||
{-
|
||||
-- | The space after the current element
|
||||
thickness :: Lens (Element mat a) (Element mat a) a a
|
||||
@@ -94,12 +104,14 @@ liftFp inj (s@Surface{_thickness, _outsideRadius, _roc, _material}) = (\t' or' r
|
||||
liftFp inj (s@Stop{_thickness, _outsideRadius}) = (\t' or' -> Stop{_thickness=t', _outsideRadius=or'}) <$> inj _thickness <*> inj _outsideRadius
|
||||
{-# INLINE liftFp #-}
|
||||
|
||||
specialize :: (Material mat) => Double -> [Element mat a] -> [Element Double a]
|
||||
specialize wavelength = (each.material) %~ (iorAtWavelength wavelength)
|
||||
-- | Specialize a system for a specific wavelength
|
||||
specialize :: (Material mat) => Double -> [Element mat a] -> [Element ConstMat a]
|
||||
specialize wavelength = (each.material) %~ (ConstMat . iorAtWavelength wavelength)
|
||||
-- | Annotate each material with the incoming index of refraction
|
||||
bake :: (Material mat) => Double -> [Element mat a] -> [Element BakedIOR a]
|
||||
bake wavelength mat =
|
||||
snd $
|
||||
mapAccumLOf (each.material) (\n1 n2 -> (n2, BakedIOR n1 n2)) 1 $
|
||||
mapAccumLOf (each.material) (\n1 (ConstMat n2) -> (n2, BakedIOR n1 n2)) 1 $
|
||||
specialize wavelength mat
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user