X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=fov.lisp;h=572a55b256652cd2e2dad18d4351de7f3fbdd6c1;hb=69714017bc3f5e6085872e24790c19fd65d6862b;hp=9b5ac79d1e8acc1216cee3663899ad01ab2e5228;hpb=afb52c66a55ede18c0dc3b9ca8ee4cf0e7570937;p=cl-photo.git diff --git a/fov.lisp b/fov.lisp old mode 100755 new mode 100644 index 9b5ac79..572a55b --- 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))) +