1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10; Package: photo -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
6 ;;;; Purpose: Field of view functions for cl-photo
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: April 2005
12 ;;;; This file, part of cl-photo, is Copyright (c) 2005 by Kevin Rosenberg.
13 ;;;; Rights of modification and redistribution are in the LICENSE file.
15 ;;;; *************************************************************************
19 (defun fov-one-dim (focal-length frame-size
20 &key (projection :rectilinear))
23 (radians->degrees (* 2 (atan (/ frame-size 2 focal-length)))))
25 (radians->degrees (* 4 (asin (/ frame-size 4 focal-length)))))
27 (radians->degrees (/ (* 2 frame-size) focal-length)))
29 (radians->degrees (* 2 (asin (/ frame-size 2 focal-length)))))
31 (radians->degrees (* 4 (atan (/ frame-size 4 focal-length)))))
35 (defun fov (focal-length frame-width frame-height
36 &key (projection :rectilinear))
37 "Returns the angle of field of view for a focal length and frame size at infinity"
39 (fov-one-dim focal-length frame-width :projection projection)
40 (fov-one-dim focal-length frame-height :projection projection)
41 (fov-one-dim focal-length (diagonal frame-width frame-height)
42 :projection projection)))
44 (defun fov-format (focal-length format &key (projection :rectilinear))
45 "Returns the angle of field of view for a focal length and frame size at infinity"
48 (fov focal-length 22.7 15.1 :projection projection))
50 (fov focal-length 24 18 :projection projection))
52 (fov focal-length 36 24 :projection projection))
54 (fov focal-length 45 60 :projection projection))
56 (fov focal-length 60 60 :projection projection))
58 (fov focal-length 60 70 :projection projection))
60 (fov focal-length 60 90 :projection projection))
62 (fov focal-length (* 4 +inches->mm+) (* 5 +inches->mm+)
63 :projection projection))
65 (fov focal-length (* 8 +inches->mm+) (* 10 +inches->mm+)
66 :projection projection))