From 8910ad89a31d63e822079b060e4e2903c455fa75 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Tue, 10 May 2005 20:26:00 +0000 Subject: [PATCH] r10526: improve print-magnification with crop function --- dof.lisp | 21 +++++++++++++++------ fov.lisp | 11 +++++++++++ package.lisp | 1 + 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/dof.lisp b/dof.lisp index 11f158c..8dfdf14 100644 --- a/dof.lisp +++ b/dof.lisp @@ -19,17 +19,26 @@ (in-package #:photo) +(defun sort-size (size) + "Returns a cons pair with the smaller size first." + (if (>= (car size) (cdr size)) + (cons (cdr size) (car size)) + (cons (car size) (cdr size)))) + +(defun print-magnification (imager-size print-size) + "Returns the magnification required between an imager and print sizes +while taking crop into consideration." + (setf imager-size (sort-size imager-size)) + (setf print-size (sort-size print-size)) + (float (max (/ (car print-size) (car imager-size)) + (/ (cdr print-size) (cdr print-size))))) + (defun coc (imager-size &key (lpm 5) (minimum-distance 250) (viewing-distance 250) (print-size (output-dimensions :8x10in))) "Returns circle of confusion in mm and print magnification for a format. Default resolving power is 5 lpm at 25cm." - - (let* ((imager-max (max (car imager-size) (cdr imager-size))) - (imager-min (min (car imager-size) (cdr imager-size))) - (print-max (max (car print-size) (cdr print-size))) - (print-min (min (car print-size) (cdr print-size))) - (magnification (max (/ print-max imager-max) (/ print-min imager-min))) + (let* ((magnification (print-magnification imager-size print-size)) (resolution-factor (/ (* magnification lpm minimum-distance) viewing-distance)) (coc (/ 1.0d0 resolution-factor))) (values coc magnification))) diff --git a/fov.lisp b/fov.lisp index 211820a..6fec649 100644 --- a/fov.lisp +++ b/fov.lisp @@ -208,3 +208,14 @@ Returns: focal-length object-distance image-distance magnification bellows-facto "Returns the bellows factor, the ratio of effective aperature to actual aperture." (1+ (magnification :focal-length focal-length :object-distance object-distance))) +(defun extension-tube (focal-length &key original-object-distance new-object-distance original-image-distance + new-object-distnace original-magnification new-magification + extension-length (units :feet)) + "Computes the parameters for using extension tubes. +Requires: 1. original-object-distance, original-image-distance, or original-magnification + 2. new-object-distance, new-image-distance, new-magnification, or extension-length +Returns: original-object-distance, original-image-distance, original-magnification, + new-object-distance, new-image-distance, new-magnification, extension-length." + ) + + diff --git a/package.lisp b/package.lisp index 5b28e2d..ffdf7e7 100644 --- a/package.lisp +++ b/package.lisp @@ -42,6 +42,7 @@ #:close-up ;; dof.lisp + #:print-magnification #:coc #:coc-format #:coc-pixels -- 2.34.1