1 |
< |
/* Copyright (c) 1996 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1997 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
98 |
|
rdirscan(y)[x]); |
99 |
|
if (t2 <= FTINY) continue; |
100 |
|
/* use approximation instead |
101 |
< |
t2 = acos(t2); |
102 |
< |
t2 = 1./(t2*t2); |
101 |
> |
t3 = acos(t2); |
102 |
> |
t2 = t2/(t3*t3); |
103 |
|
*/ |
104 |
< |
t2 = .5 / (1. - t2); |
104 |
> |
t2 *= .5 / (1. - t2); |
105 |
|
copycolor(ctmp, fovscan(y)[x]); |
106 |
|
scalecolor(ctmp, t2); |
107 |
|
addcolor(vsum, ctmp); |
108 |
|
t2sum += t2; |
109 |
|
} |
110 |
|
/* VADAPT of original is subtracted in addveil() */ |
111 |
< |
scalecolor(vsum, VADAPT/t2sum); |
111 |
> |
if (t2sum > FTINY) |
112 |
> |
scalecolor(vsum, VADAPT/t2sum); |
113 |
|
copycolor(veilscan(py)[px], vsum); |
114 |
|
} |
115 |
|
/* modify FOV sample image */ |
172 |
|
double |
173 |
|
hacuity(La) /* return visual acuity in cycles/degree */ |
174 |
|
double La; |
175 |
< |
{ /* data due to S. Shaler (we should fit it!) */ |
176 |
< |
#define NPOINTS 20 |
177 |
< |
static float l10lum[NPOINTS] = { |
177 |
< |
-3.10503,-2.66403,-2.37703,-2.09303,-1.64403,-1.35803, |
178 |
< |
-1.07403,-0.67203,-0.38503,-0.10103,0.29397,0.58097,0.86497, |
179 |
< |
1.25697,1.54397,1.82797,2.27597,2.56297,2.84697,3.24897 |
180 |
< |
}; |
181 |
< |
static float resfreq[NPOINTS] = { |
182 |
< |
2.09,3.28,3.79,4.39,6.11,8.83,10.94,18.66,23.88,31.05,37.42, |
183 |
< |
37.68,41.60,43.16,45.30,47.00,48.43,48.32,51.06,51.09 |
184 |
< |
}; |
185 |
< |
double l10La; |
186 |
< |
register int i; |
187 |
< |
/* check limits */ |
188 |
< |
if (La <= 7.85e-4) |
189 |
< |
return(resfreq[0]); |
190 |
< |
if (La >= 1.78e3) |
191 |
< |
return(resfreq[NPOINTS-1]); |
192 |
< |
/* interpolate data */ |
193 |
< |
l10La = log10(La); |
194 |
< |
for (i = 0; i < NPOINTS-2 && l10lum[i+1] <= l10La; i++) |
195 |
< |
; |
196 |
< |
return( ( (l10lum[i+1] - l10La)*resfreq[i] + |
197 |
< |
(l10La - l10lum[i])*resfreq[i+1] ) / |
198 |
< |
(l10lum[i+1] - l10lum[i]) ); |
199 |
< |
#undef NPOINTS |
175 |
> |
{ |
176 |
> |
/* functional fit */ |
177 |
> |
return(17.25*atan(1.4*log10(La) + 0.35) + 25.72); |
178 |
|
} |
179 |
|
|
180 |
|
|
286 |
|
/* get scanlines */ |
287 |
|
sl0 = getascan(sb, iy); |
288 |
|
#ifdef DEBUG |
289 |
< |
if (sl0 == NULL) { |
290 |
< |
fprintf(stderr, "%s: internal - cannot backspace in ascanval\n", |
313 |
< |
progname); |
314 |
< |
abort(); |
315 |
< |
} |
289 |
> |
if (sl0 == NULL) |
290 |
> |
error(INTERNAL, "cannot backspace in ascanval"); |
291 |
|
#endif |
292 |
|
sl1 = getascan(sb, iy+1); |
293 |
|
/* 2D linear interpolation */ |