r10440: add tables
[cl-photo.git] / fov.lisp
index 9b5ac79d1e8acc1216cee3663899ad01ab2e5228..572a55b256652cd2e2dad18d4351de7f3fbdd6c1 100755 (executable)
--- a/fov.lisp
+++ b/fov.lisp
@@ -50,14 +50,17 @@ Default is infinity (magnification 0)"
    (aov-one-dim focal-length (diagonal frame-width frame-height)
                 :projection projection :magnification magnification)))
 
-(defun gaussian-lens (focal-length object-distance)
-  "Returns the image distance for a focused object at distance."
-  (float (/ 1 (- (/ 1 focal-length) (/ 1 object-distance)))))
+(defun image-distance (focal-length object-distance)
+  "Returns the image distance for a focused object at distance using the Gaussian 
+Lens Equation."
+  (if (= focal-length object-distance)
+      0
+    (float (/ 1 (- (/ 1 focal-length) (/ 1 object-distance))))))
 
 (defun fov (focal-length frame-width frame-height object-distance
                          &key (projection :rectilinear))
   "Returns the field of view and image magnificaion ratio at a given distance."
-  (let* ((image-distance (gaussian-lens focal-length object-distance))
+  (let* ((image-distance (image-distance focal-length object-distance))
          (magnification (/ image-distance object-distance)))
     (multiple-value-bind (aov-width aov-height aov-diagonal)
         (aov focal-length frame-width frame-height :projection projection
@@ -69,5 +72,14 @@ Default is infinity (magnification 0)"
 
 (defun aov-format (focal-length format &key (projection :rectilinear))
   "Returns the angle of field of view for a focal length and frame size at infinity"
-  (let ((dim (format-dimensions format))) 
+  (let ((dim (imager-dimensions format))) 
     (aov focal-length (car dim) (cdr dim) :projection projection)))
+
+(defun magnification (focal-length distance)
+  "Returns the image magnification: the ratio of image size to objecct size."
+  (float (/ focal-length (- distance focal-length))))
+
+(defun bellows-factor (focal-length distance)
+  "Returns the bellows factor, the ratio of effective aperature to actual aperture."
+  (1+ (magnification focal-length distance)))
+