373 |
|
|
374 |
|
|
375 |
|
void |
376 |
+ |
getorigin( /* origin viewpoint */ |
377 |
+ |
char *s |
378 |
+ |
) |
379 |
+ |
{ |
380 |
+ |
VIEW nv = ourview; |
381 |
+ |
double d; |
382 |
+ |
/* get new view origin */ |
383 |
+ |
if (!sscanvec(s, nv.vp)) { |
384 |
+ |
int x, y; |
385 |
+ |
RAY thisray; |
386 |
+ |
if (dev->getcur == NULL) |
387 |
+ |
return; |
388 |
+ |
(*dev->comout)("Pick point on surface for new origin\n"); |
389 |
+ |
if ((*dev->getcur)(&x, &y) == ABORT) |
390 |
+ |
return; |
391 |
+ |
if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, |
392 |
+ |
&ourview, (x+.5)/hresolu, (y+.5)/vresolu)) < -FTINY) { |
393 |
+ |
error(COMMAND, "not on image"); |
394 |
+ |
return; |
395 |
+ |
} |
396 |
+ |
rayorigin(&thisray, PRIMARY, NULL, NULL); |
397 |
+ |
if (!localhit(&thisray, &thescene)) { |
398 |
+ |
error(COMMAND, "not a local object"); |
399 |
+ |
return; |
400 |
+ |
} |
401 |
+ |
if (thisray.rod < 0.0) /* don't look through other side */ |
402 |
+ |
flipsurface(&thisray); |
403 |
+ |
VSUM(nv.vp, thisray.rop, thisray.ron, 2.0*FTINY); |
404 |
+ |
VCOPY(nv.vdir, thisray.ron); |
405 |
+ |
} else if (!sscanvec(sskip2(s,3), nv.vdir) || normalize(nv.vdir) == 0.0) |
406 |
+ |
VCOPY(nv.vdir, ourview.vdir); |
407 |
+ |
|
408 |
+ |
d = DOT(nv.vdir, nv.vup); /* need different up vector? */ |
409 |
+ |
if (d*d >= 1.-2.*FTINY) { |
410 |
+ |
int i; |
411 |
+ |
nv.vup[0] = nv.vup[1] = nv.vup[2] = 0.0; |
412 |
+ |
for (i = 3; i--; ) |
413 |
+ |
if (nv.vdir[i]*nv.vdir[i] < 0.34) |
414 |
+ |
break; |
415 |
+ |
nv.vup[i] = 1.; |
416 |
+ |
} |
417 |
+ |
newview(&nv); |
418 |
+ |
} |
419 |
+ |
|
420 |
+ |
|
421 |
+ |
void |
422 |
|
getexposure( /* get new exposure */ |
423 |
|
char *s |
424 |
|
) |