Converted from roc to curvature
This commit is contained in:
@@ -16,6 +16,7 @@ module Petzval.Optics
|
||||
, outsideRadius
|
||||
, material
|
||||
, roc
|
||||
, curvature
|
||||
, liftFp
|
||||
, specialize, bake
|
||||
) where
|
||||
@@ -59,7 +60,7 @@ data Element mat fp =
|
||||
-- | Refractive surface
|
||||
Surface { _thickness :: fp
|
||||
, _outsideRadius :: fp
|
||||
, _roc :: fp
|
||||
, _curvature :: fp
|
||||
, _material :: mat
|
||||
}
|
||||
-- | Aperture stop
|
||||
@@ -67,9 +68,14 @@ data Element mat fp =
|
||||
_thickness :: fp
|
||||
, _outsideRadius :: fp
|
||||
}
|
||||
-- | Imaging plane. This is a hack to make sure that rays go all the way to the target plane
|
||||
| ImagingPlane { _thickness :: fp }
|
||||
deriving (Show)
|
||||
makeLenses ''Element
|
||||
|
||||
roc :: Fractional fp => Traversal' (Element mat fp) fp
|
||||
roc = curvature . iso (1/) (1/)
|
||||
|
||||
-- | Determine if an element is a stop
|
||||
isStop :: Element mat a -> Bool
|
||||
isStop Stop{} = True
|
||||
@@ -82,7 +88,7 @@ isSurface _ = False
|
||||
-- | Translate a lens element from one FP type to another. E.g., can be used to convert from scalars to the types in an automatic differentiation tool.
|
||||
liftFp :: (Applicative f) => (fp -> f fp') -> Element m fp -> f (Element m fp')
|
||||
liftFp inj (s@Stop{_thickness, _outsideRadius}) = Stop <$> inj _thickness <*> inj _outsideRadius
|
||||
liftFp inj (s@Surface{_thickness, _outsideRadius, _roc, _material}) = Surface <$> inj _thickness <*> inj _outsideRadius <*> inj _roc <*> pure _material
|
||||
liftFp inj (s@Surface{_thickness, _outsideRadius, _curvature, _material}) = Surface <$> inj _thickness <*> inj _outsideRadius <*> inj _curvature <*> pure _material
|
||||
{-# INLINE liftFp #-}
|
||||
|
||||
-- | Specialize a system for a specific wavelength
|
||||
|
||||
Reference in New Issue
Block a user