| 260 |
|
} |
| 261 |
|
|
| 262 |
|
|
| 263 |
< |
moveview(angle, mag, vc) /* move viewpoint */ |
| 264 |
< |
double angle, mag; |
| 263 |
> |
moveview(angle, elev, mag, vc) /* move viewpoint */ |
| 264 |
> |
double angle, elev, mag; |
| 265 |
|
FVECT vc; |
| 266 |
|
{ |
| 267 |
|
extern double sqrt(), dist2(); |
| 268 |
|
double d; |
| 269 |
+ |
FVECT v1; |
| 270 |
|
VIEW nv; |
| 271 |
|
register int i; |
| 272 |
|
|
| 273 |
|
VCOPY(nv.vup, ourview.vup); |
| 274 |
|
nv.hresolu = ourview.hresolu; nv.vresolu = ourview.vresolu; |
| 275 |
|
spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.)); |
| 276 |
< |
d = sqrt(dist2(ourview.vp, vc)) / mag; |
| 277 |
< |
for (i = 0; i < 3; i++) |
| 278 |
< |
nv.vp[i] = vc[i] - d*nv.vdir[i]; |
| 276 |
> |
if (elev != 0.0) { |
| 277 |
> |
fcross(v1, ourview.vup, nv.vdir); |
| 278 |
> |
normalize(v1); |
| 279 |
> |
spinvector(nv.vdir, nv.vdir, v1, elev*(PI/180.)); |
| 280 |
> |
} |
| 281 |
|
if ((nv.type = ourview.type) == VT_PAR) { |
| 282 |
|
nv.horiz = ourview.horiz / mag; |
| 283 |
|
nv.vert = ourview.vert / mag; |
| 284 |
+ |
d = 0.0; /* don't move closer */ |
| 285 |
+ |
for (i = 0; i < 3; i++) |
| 286 |
+ |
d += (vc[i] - ourview.vp[i])*ourview.vdir[i]; |
| 287 |
|
} else { |
| 288 |
|
nv.horiz = ourview.horiz; |
| 289 |
|
nv.vert = ourview.vert; |
| 290 |
+ |
d = sqrt(dist2(ourview.vp, vc)) / mag; |
| 291 |
|
} |
| 292 |
+ |
for (i = 0; i < 3; i++) |
| 293 |
+ |
nv.vp[i] = vc[i] - d*nv.vdir[i]; |
| 294 |
|
newview(&nv); |
| 295 |
|
} |
| 296 |
|
|