;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10; Package: photo -*- ;;;; ************************************************************************* ;;;; FILE IDENTIFICATION ;;;; ;;;; Name: fov.lisp ;;;; Purpose: Field of view functions for cl-photo ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: April 2005 ;;;; ;;;; $Id$ ;;;; ;;;; This file, part of cl-photo, is Copyright (c) 2005 by Kevin Rosenberg. ;;;; Rights of modification and redistribution are in the LICENSE file. ;;;; ;;;; ************************************************************************* (in-package #:photo) (defun fov-one-dim (focal-length frame-size &key (projection :rectilinear)) (ecase projection (:rectilinear (radians->degrees (* 2 (atan (/ frame-size 2 focal-length))))) (:equisolid (radians->degrees (* 4 (asin (/ frame-size 4 focal-length))))) (:equidistance (radians->degrees (/ (* 2 frame-size) focal-length))) (:orthogonal (radians->degrees (* 2 (asin (/ frame-size 2 focal-length))))) (:stereographic (radians->degrees (* 4 (atan (/ frame-size 4 focal-length))))) )) (defun fov (focal-length frame-width frame-height &key (projection :rectilinear)) "Returns the angle of field of view for a focal length and frame size at infinity" (values (fov-one-dim focal-length frame-width :projection projection) (fov-one-dim focal-length frame-height :projection projection) (fov-one-dim focal-length (diagonal frame-width frame-height) :projection projection))) (defun fov-format (focal-length format &key (projection :rectilinear)) "Returns the angle of field of view for a focal length and frame size at infinity" (ecase format (:aps-c (fov focal-length 22.7 15.1 :projection projection)) (:aps (fov focal-length 24 18 :projection projection)) (:35mm (fov focal-length 36 24 :projection projection)) (:4.5x6 (fov focal-length 45 60 :projection projection)) (:6x6 (fov focal-length 60 60 :projection projection)) (:6x7 (fov focal-length 60 70 :projection projection)) (:6x9 (fov focal-length 60 90 :projection projection)) (:4x5 (fov focal-length (* 4 +inches->mm+) (* 5 +inches->mm+) :projection projection)) (:8x10 (fov focal-length (* 8 +inches->mm+) (* 10 +inches->mm+) :projection projection)) ))