374 |
|
) |
375 |
|
{ |
376 |
|
VIEW nv = ourview; |
377 |
+ |
FVECT voff; |
378 |
+ |
int i; |
379 |
|
double d; |
380 |
< |
/* get new view origin */ |
381 |
< |
if (sscanf(s, "%lf %lf", &d, &d) == 1) { |
382 |
< |
/* just moving some distance */ |
383 |
< |
VSUM(nv.vp, nv.vp, nv.vdir, d); |
384 |
< |
} else if (!sscanvec(s, nv.vp)) { |
385 |
< |
int x, y; /* need to pick origin */ |
380 |
> |
/* check for view origin shift */ |
381 |
> |
if (sscanf(s, "%lf", &d) == 1) { |
382 |
> |
double d_fore=d, d_right=0, d_up=0; |
383 |
> |
sscanf(s, "%*f %lf %lf", &d_right, &d_up); |
384 |
> |
d_right /= sqrt(nv.hn2); |
385 |
> |
for (i = 3; i--; ) |
386 |
> |
nv.vp[i] += d_fore*nv.vdir[i] + |
387 |
> |
d_right*nv.hvec[i] + |
388 |
> |
d_up*nv.vup[i]; |
389 |
> |
} else { /* else pick new origin */ |
390 |
> |
int x, y; |
391 |
|
RAY thisray; |
392 |
|
if (dev->getcur == NULL) |
393 |
|
return; |
408 |
|
flipsurface(&thisray); |
409 |
|
VSUM(nv.vp, thisray.rop, thisray.ron, 20.0*FTINY); |
410 |
|
VCOPY(nv.vdir, thisray.ron); |
411 |
< |
} else if (!sscanvec(sskip2(s,3), nv.vdir) || normalize(nv.vdir) == 0.0) |
412 |
< |
VCOPY(nv.vdir, ourview.vdir); |
413 |
< |
|
414 |
< |
d = DOT(nv.vdir, nv.vup); /* need different up vector? */ |
415 |
< |
if (d*d >= 1.-2.*FTINY) { |
416 |
< |
int i; |
417 |
< |
nv.vup[0] = nv.vup[1] = nv.vup[2] = 0.0; |
418 |
< |
for (i = 3; i--; ) |
419 |
< |
if (nv.vdir[i]*nv.vdir[i] < 0.34) |
413 |
< |
break; |
414 |
< |
nv.vup[i] = 1.; |
411 |
> |
d = DOT(nv.vdir, nv.vup); |
412 |
> |
if (d*d >= 1.-2.*FTINY) { |
413 |
> |
/* need different up vector */ |
414 |
> |
nv.vup[0] = nv.vup[1] = nv.vup[2] = 0.0; |
415 |
> |
for (i = 3; i--; ) |
416 |
> |
if (nv.vdir[i]*nv.vdir[i] < 0.34) |
417 |
> |
break; |
418 |
> |
nv.vup[i] = 1.; |
419 |
> |
} |
420 |
|
} |
421 |
|
newview(&nv); |
422 |
|
} |
796 |
|
if (thisray.rot >= FHUGE*.99) |
797 |
|
(*dev->comout)("at infinity"); |
798 |
|
else { |
799 |
< |
sprintf(buf, "at (%.6g %.6g %.6g) (%.6g)", |
799 |
> |
sprintf(buf, "at (%.3f %.3f %.3f) (%.6g)", |
800 |
|
thisray.rop[0], thisray.rop[1], |
801 |
|
thisray.rop[2], raydistance(&thisray)); |
802 |
|
(*dev->comout)(buf); |
803 |
|
} |
804 |
|
(*dev->comin)(buf, NULL); |
805 |
|
scolor_rgb(col, thisray.rcol); |
806 |
< |
sprintf(buf, "value (%.5g %.5g %.5g) (%.3gL)", |
806 |
> |
sprintf(buf, "value (%.4g %.4g %.4g) (%.3gL)", |
807 |
|
colval(col,RED), |
808 |
|
colval(col,GRN), |
809 |
|
colval(col,BLU), |