7 ;; X-----+-------------------------------
14 ;; ---------------------+----------------------------------------
19 (defmethod back-focal-plane-radius ((objective objective
))
20 (declare (values double-float
&optional
))
21 (with-slots (focal-length numerical-aperture
) objective
22 (* focal-length numerical-aperture
)))
24 (defun focal-length-from-magnification (mag)
25 (declare (double-float mag
)
26 (values double-float
&optional
))
29 (focal-length-from-magnification 63d0
)
31 (defun make-objective (&key
(magnification 63d0
)
32 (numerical-aperture 1.38d0
)
33 (immersion-index 1.515d0
)
36 (let* ((f (focal-length-from-magnification magnification
))
37 (o (make-instance 'objective
38 :bfp-radius
1d0
;; these need to be generated
41 :numerical-aperture numerical-aperture
42 :immersion-index immersion-index
45 (bfp-radius (back-focal-plane-radius o
)))
46 (make-instance 'objective
47 :bfp-radius bfp-radius
49 :radius
(* 10 bfp-radius
)
50 :numerical-aperture numerical-aperture
51 :immersion-index immersion-index
57 (defmethod get-ray-behind-objective ((obj objective
)
58 x-mm y-mm bfp-x
/r bfp-y
/r
)
59 "Take a point on the back focal plane and a point in the sample and
60 calculate the ray direction ro that leaves the objective. The return
61 values are the exiting ray with normalized direction from the
62 principal plane and the entering ray from the bfp."
63 (declare (double-float x-mm y-mm
)
64 ((double-float -
1d0
1d0
) bfp-x
/r bfp-y
/r
)
65 (values ray ray
&optional
))
66 (with-slots (bfp-radius center
68 (let* ((theta (find-inverse-ray-angle obj x-mm y-mm
))
69 (phi (atan y-mm x-mm
))
70 (start (v+ center
(make-vec (* bfp-radius bfp-x
/r
)
71 (* bfp-radius bfp-y
/r
)
73 (enter (make-instance 'ray
75 :direction
(v-spherical theta phi
)))
76 (exit (refract enter obj
))
77 (norm-exit (make-instance
79 :start
(vector::start exit
)
80 :direction
(normalize (vector::direction exit
)))))
81 (values norm-exit enter
))))
84 (get-ray-behind-objective .1d0
.1d0
0d0
0d0
)