| 63 |
|
v->hn2 = 2.0 * tan(v->horiz*(PI/180.0/2.0)); |
| 64 |
|
v->vn2 = 2.0 * tan(v->vert*(PI/180.0/2.0)); |
| 65 |
|
break; |
| 66 |
+ |
case VT_CYL: /* cylindrical panorama */ |
| 67 |
+ |
if (v->horiz > 360.0+FTINY) |
| 68 |
+ |
return(ill_horiz); |
| 69 |
+ |
if (v->vert >= 180.0-FTINY) |
| 70 |
+ |
return(ill_vert); |
| 71 |
+ |
v->hn2 = v->horiz * (PI/180.0); |
| 72 |
+ |
v->vn2 = 2.0 * tan(v->vert*(PI/180.0/2.0)); |
| 73 |
+ |
break; |
| 74 |
|
case VT_ANG: /* angular fisheye */ |
| 75 |
|
if (v->horiz > 360.0+FTINY) |
| 76 |
|
return(ill_horiz); |
| 77 |
|
if (v->vert > 360.0+FTINY) |
| 78 |
|
return(ill_vert); |
| 79 |
< |
v->hn2 = v->horiz / 90.0; |
| 80 |
< |
v->vn2 = v->vert / 90.0; |
| 79 |
> |
v->hn2 = v->horiz * (PI/180.0); |
| 80 |
> |
v->vn2 = v->vert * (PI/180.0); |
| 81 |
|
break; |
| 82 |
|
case VT_HEM: /* hemispherical fisheye */ |
| 83 |
|
if (v->horiz > 180.0+FTINY) |
| 91 |
|
return("unknown view type"); |
| 92 |
|
} |
| 93 |
|
if (v->type != VT_ANG) { |
| 94 |
< |
v->hvec[0] *= v->hn2; |
| 95 |
< |
v->hvec[1] *= v->hn2; |
| 96 |
< |
v->hvec[2] *= v->hn2; |
| 94 |
> |
if (v->type != VT_CYL) { |
| 95 |
> |
v->hvec[0] *= v->hn2; |
| 96 |
> |
v->hvec[1] *= v->hn2; |
| 97 |
> |
v->hvec[2] *= v->hn2; |
| 98 |
> |
} |
| 99 |
|
v->vvec[0] *= v->vn2; |
| 100 |
|
v->vvec[1] *= v->vn2; |
| 101 |
|
v->vvec[2] *= v->vn2; |
| 163 |
|
orig[1] = v->vp[1] + v->vfore*direc[1]; |
| 164 |
|
orig[2] = v->vp[2] + v->vfore*direc[2]; |
| 165 |
|
return(v->vaft > FTINY ? v->vaft - v->vfore : 0.0); |
| 166 |
+ |
case VT_CYL: /* cylindrical panorama */ |
| 167 |
+ |
d = x * v->horiz * (PI/180.0); |
| 168 |
+ |
z = cos(d); |
| 169 |
+ |
x = sin(d); |
| 170 |
+ |
direc[0] = z*v->vdir[0] + x*v->hvec[0] + y*v->vvec[0]; |
| 171 |
+ |
direc[1] = z*v->vdir[1] + x*v->hvec[1] + y*v->vvec[1]; |
| 172 |
+ |
direc[2] = z*v->vdir[2] + x*v->hvec[2] + y*v->vvec[2]; |
| 173 |
+ |
orig[0] = v->vp[0] + v->vfore*direc[0]; |
| 174 |
+ |
orig[1] = v->vp[1] + v->vfore*direc[1]; |
| 175 |
+ |
orig[2] = v->vp[2] + v->vfore*direc[2]; |
| 176 |
+ |
d = normalize(direc); |
| 177 |
+ |
return(v->vaft > FTINY ? (v->vaft - v->vfore)*d : 0.0); |
| 178 |
|
case VT_ANG: /* angular fisheye */ |
| 179 |
|
x *= v->horiz/180.0; |
| 180 |
|
y *= v->vert/180.0; |
| 237 |
|
ip[2] = d; |
| 238 |
|
ip[2] -= v->vfore; |
| 239 |
|
break; |
| 240 |
+ |
case VT_CYL: /* cylindrical panorama */ |
| 241 |
+ |
ip[2] = DOT(disp,v->vdir); |
| 242 |
+ |
d = DOT(disp,v->hvec); |
| 243 |
+ |
ip[0] = 180.0/PI * atan2(d,ip[2]) / v->horiz + 0.5 - v->hoff; |
| 244 |
+ |
ip[1] = DOT(disp,v->vvec)/v->vn2 + 0.5 - v->voff; |
| 245 |
+ |
if (v->vfore > FTINY) |
| 246 |
+ |
ip[2] = sqrt(DOT(disp,disp)) * |
| 247 |
+ |
(1.0 - v->vfore/sqrt(d*d + ip[2]*ip[2])); |
| 248 |
+ |
else |
| 249 |
+ |
ip[2] = sqrt(DOT(disp,disp)); |
| 250 |
+ |
return; |
| 251 |
|
case VT_ANG: /* angular fisheye */ |
| 252 |
|
ip[0] = 0.5 - v->hoff; |
| 253 |
|
ip[1] = 0.5 - v->voff; |
| 257 |
|
return; |
| 258 |
|
if (d <= -(1.0-FTINY)) { |
| 259 |
|
ip[0] += 180.0/v->horiz; |
| 227 |
– |
ip[1] += 180.0/v->vert; |
| 260 |
|
return; |
| 261 |
|
} |
| 262 |
|
d = acos(d)/PI / sqrt(1.0 - d*d); |