scan of worm works now
[woropt.git] / lens / objects.lisp
blob86bc5ad22e7239a160971a2587661fe1bc5855c2
1 (in-package :lens)
3 (defclass plane ()
4 ((normal :accessor normal :initarg :normal :initform #.(v 0 0 1) :type vec)
5 (center :accessor center :initarg :center :initform #.(v 0 0 0) :type vec)))
7 (defclass disk (plane)
8 ((radius :accessor radius :initarg :radius :initform 1d0 :type double-float)))
10 (defclass lens (disk)
11 ((focal-length :accessor focal-length
12 :initarg :focal-length
13 :initform 1d0
14 :type double-float)))
16 (defclass objective (lens)
17 ;; set the lens-radius to something bigger (maybe twice bfp-radius)
18 ;; to prevent spurious RAY-LOST when dispatching to lens refract
19 ((immersion-index :accessor immersion-index :initarg :immersion-index
20 :initform (alexandria:required-argument)
21 :type double-float)
22 (numerical-aperture :accessor numerical-aperture :initarg :numerical-aperture
23 :initform (alexandria:required-argument)
24 :type double-float)
25 (bfp-radius :accessor bfp-radius :initarg :bfp-radius
26 :initform (alexandria:required-argument)
27 :type double-float)))
29 (defmethod print-object ((objective objective) stream)
30 (with-slots (immersion-index numerical-aperture focal-length bfp-radius) objective
31 (format stream "#<objective ~3,1fx f: ~2,2f na: ~f n: ~f bfp-radius: ~2,3f>"
32 (/ 164.5 focal-length) focal-length
33 numerical-aperture immersion-index bfp-radius)))