r10439: canera database
[cl-photo.git] / fov.lisp
index 9b5ac79d1e8acc1216cee3663899ad01ab2e5228..23ca941d517f28b73f5a0b96ac81107442ba7e76 100755 (executable)
--- a/fov.lisp
+++ b/fov.lisp
@@ -50,14 +50,15 @@ 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."
+(defun image-distance (focal-length object-distance)
+  "Returns the image distance for a focused object at distance using the Gaussian 
+Lens Equation."
   (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
@@ -71,3 +72,12 @@ Default is infinity (magnification 0)"
   "Returns the angle of field of view for a focal length and frame size at infinity"
   (let ((dim (format-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)))
+