r10456: add rayleigh
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sat, 23 Apr 2005 10:42:57 +0000 (10:42 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sat, 23 Apr 2005 10:42:57 +0000 (10:42 +0000)
cameras.lisp
doc/readme.lml
dof.lisp
package.lisp

index 9b93505e7c7d08a8779c1468ba54148ca73c7757..293b21955a108dcc153716bf4c2d018c59254b34 100644 (file)
   
 
 (defun format-match-p (format-spec format)
   
 
 (defun format-match-p (format-spec format)
-  (when (or (eql format-spec (getf format :format))
-            (member format-spec (getf format :nicks)))
-    t))
+  (let ((key (ensure-keyword format-spec)))
+    (when (or (eql key (getf format :format))
+             (member key (getf format :nicks)))
+      t)))
 
 (defun find-format (format-spec)
   (find format-spec +format-db+ :test 'format-match-p))
 
 (defun find-format (format-spec)
   (find format-spec +format-db+ :test 'format-match-p))
index 509f598153747999ea37d6df4372acad2d569cec..322693186c7fa4cc264b2f66671b878f37089fe9 100755 (executable)
@@ -35,8 +35,8 @@
      (:h2 "References")
      (:ul
       (:li
      (:h2 "References")
      (:ul
       (:li
-       ((:a :href "http://solo.colorado.edu/~walawend/TwilightLandscapes/DoF_article.shtml")
-        "http://solo.colorado.edu/~walawend/TwilightLandscapes/DoF_article.shtml"))
+       ((:a :href "http://www.normankoren.com/Tutorials/MTF.html")
+        "http://www.normankoren.com/Tutorials/MTF.html"))
       (:li
        ((:a :href "http://www.vanwalree.com/optics/dofderivation.html")
         "http://www.vanwalree.com/optics/dofderivation.html"))
       (:li
        ((:a :href "http://www.vanwalree.com/optics/dofderivation.html")
         "http://www.vanwalree.com/optics/dofderivation.html"))
index a98b90a23bbd8ecf738ae5d70c43c69786c04cc7..5dfc5dd06e0dac523d29400f0bc58dd9f2152444 100644 (file)
--- a/dof.lisp
+++ b/dof.lisp
@@ -49,19 +49,28 @@ Default resolving power is 5 lpm at 25cm."
     (values coc print-magnification)))
 
 (defun coc-pixels (imager pixels)
     (values coc print-magnification)))
 
 (defun coc-pixels (imager pixels)
-  "Returns circle of confusion based on pixel size."
+  "Returns lpm and circle of confusion based on pixel size."
   (when (and (consp imager) (consp pixels))
   (when (and (consp imager) (consp pixels))
-    (values (float (* 2 (/ (car imager) (car pixels))))
-            (float (* 2 (/ (cdr imager) (cdr pixels)))))))
+    (let ((coc-w (float (* 2 (/ (car imager) (car pixels)))))
+         (coc-h (float (* 2 (/ (cdr imager) (cdr pixels))))))
+    (values coc-w coc-h (/ 1. coc-w) (/ 1. coc-h)))))
   
 (defun coc-pixels-format (format)
   "Returns circle of confusion based on pixel size."
   (coc-pixels (imager-dimensions format) (pixel-dimensions format)))
 
   
 (defun coc-pixels-format (format)
   "Returns circle of confusion based on pixel size."
   (coc-pixels (imager-dimensions format) (pixel-dimensions format)))
 
-(defun coc-airy (f-stop)
+(defun coc-airy (f-stop &optional (wavelength 0.000512))
   "Return the circle of confusion based on the airy disk."
   "Return the circle of confusion based on the airy disk."
-  (let ((airy (/ f-stop 1500)))
-    (float (* 2 airy))))
+  (float (/ 1 (rayleigh-limit f-stop wavelength))))
+
+(defun rayleigh-limit (f-stop &optional (wavelength 0.0005))
+  "Returns the rayleigh limit in line pairs per mm (MTF 9%) as well as the MTF50"
+  (let ((rayleigh (float (/ 1 1.22 f-stop wavelength))))
+    (values rayleigh (* 0.46 rayleigh))))
+
+(defun maximum-sharpness-aperture (format &optional (wavelength 0.0005))
+  (multiple-value-bind (coc-w coc-h lpm-w lpm-h) (coc-pixels-format format)
+    (/ 1. (* 1.22 wavelength (/ (min lpm-w lpm-h) 0.46)))))
 
 (defun dof-mm (focal-length f-stop distance coc &key (pupil-factor 1))
   "Returns depth of field based on focal-length, f-stop, distance, and coc.
 
 (defun dof-mm (focal-length f-stop distance coc &key (pupil-factor 1))
   "Returns depth of field based on focal-length, f-stop, distance, and coc.
index 0b9d3ea446df1dcf0444221eea07f417a88f0b93..093e46fbb6e5909b3a91ba13c8f462f40fb75650 100644 (file)
@@ -48,7 +48,9 @@
    #:dof
    #:hyperfocal
    #:effective-aperture
    #:dof
    #:hyperfocal
    #:effective-aperture
-
+   #:rayleigh-limit
+   #:maximum-sharpness-calculator
+   
    ;; tables.lisp
    #:hyperfocal-table
    #:aov-table
    ;; tables.lisp
    #:hyperfocal-table
    #:aov-table