File: RetinalMMToDegrees.m

package info (click to toggle)
psychtoolbox-3 3.0.19.14.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 86,796 kB
  • sloc: ansic: 176,245; cpp: 20,103; objc: 5,393; sh: 2,753; python: 1,397; php: 384; makefile: 193; java: 113
file content (46 lines) | stat: -rw-r--r-- 1,954 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function degs = RetinalMMToDegrees(mm,eyeLengthMM,fulltrig)
% degs = RetinalMMToDegrees(mm,eyeLengthMM,[fulltrig])
%
% Convert fovela extent in mm of retina in the fovea to degrees of visual
% angle.
%
% This is implemented by default as a simple linear scaling based on the
% appropriate conversion for small angles.  It does not take the
% non-linearity of the tangent for larger angles into account, nor the
% actual shape and optics of the eye.  Interestingly, although the trig
% calculation would be exactly correct for pinhole camera and a planar
% retina oriented orthogonal to the optical axis, it deviates more from
% what the real eye does than the linear approximation.
%
% In addition, this routine is implemented as the exact inverse of what
% DegreesToRetinalMM does, rather than having the two routines do
% independent forward and backward linear approximations.
%
% If optional argument fulltrig is passed as true (it is false by default),
% then it uses the inverse tangent on the actuall passed mm.  This was the
% behavior prior to July 2015. This behavior does not exactly self invert
% with DegreesToRetinalMM.  Nor does it account for the shape and optics of
% the eye.
% 
% Routine EyeLength returns posterior nodal eye lengths for various species
% and sources.  Use 'Human' and 'Rodieck' to get the eye lenght implicit in
% RetinalEccentricityMMToDegrees and DegreesToRetinalEccentricityMM for
% human, and similarly 'Rhesus' and 'PerryCowey' for rhesus.
%
% See also: DegreesToRetinalMM, EyeLength, RetinalEccentricityMMToDegrees, DegreesToRetinalEccentricityMM
%
% 7/15/03  dhb  Wrote it.
% 7/01/15  dhb  Update comments, change default behavior, preserve old behavior optionally.

% Default args
if (nargin < 3 || isempty(fulltrig))
    fulltrig = false;
end

if (~fulltrig)
    factor = 1/DegreesToRetinalMM(1,eyeLengthMM);
    degs = factor*mm;
else
    tanarg = (mm/2)/eyeLengthMM;
    degs = 2*(180/pi)*atan(tanarg);
end