205 |
|
register VIEW *v; |
206 |
|
FVECT p; |
207 |
|
{ |
208 |
< |
double d; |
208 |
> |
double d, d2; |
209 |
|
FVECT disp; |
210 |
|
|
211 |
|
disp[0] = p[0] - v->vp[0]; |
218 |
|
break; |
219 |
|
case VT_PER: /* perspective view */ |
220 |
|
d = DOT(disp,v->vdir); |
221 |
< |
ip[2] = sqrt(DOT(disp,disp)); |
221 |
> |
ip[2] = VLEN(disp); |
222 |
|
if (d < 0.0) { /* fold pyramid */ |
223 |
|
ip[2] = -ip[2]; |
224 |
|
d = -d; |
240 |
|
ip[2] -= v->vfore; |
241 |
|
break; |
242 |
|
case VT_CYL: /* cylindrical panorama */ |
243 |
– |
ip[2] = DOT(disp,v->vdir); |
243 |
|
d = DOT(disp,v->hvec); |
244 |
< |
ip[0] = 180.0/PI * atan2(d,ip[2]) / v->horiz + 0.5 - v->hoff; |
245 |
< |
ip[1] = DOT(disp,v->vvec)/v->vn2 + 0.5 - v->voff; |
244 |
> |
d2 = DOT(disp,v->vdir); |
245 |
> |
ip[0] = 180.0/PI * atan2(d,d2) / v->horiz + 0.5 - v->hoff; |
246 |
> |
d = 1.0/sqrt(d*d + d2*d2); |
247 |
> |
ip[1] = DOT(disp,v->vvec)*d/v->vn2 + 0.5 - v->voff; |
248 |
> |
ip[2] = VLEN(disp); |
249 |
|
if (v->vfore > FTINY) |
250 |
< |
ip[2] = sqrt(DOT(disp,disp)) * |
249 |
< |
(1.0 - v->vfore/sqrt(d*d + ip[2]*ip[2])); |
250 |
< |
else |
251 |
< |
ip[2] = sqrt(DOT(disp,disp)); |
250 |
> |
ip[2] *= (1.0 - v->vfore*d); |
251 |
|
return; |
252 |
|
case VT_ANG: /* angular fisheye */ |
253 |
|
ip[0] = 0.5 - v->hoff; |