| 1 |
< |
/* Copyright (c) 1987 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1994 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 103 |
|
(*dev->comout)("Pick view center\n"); |
| 104 |
|
if ((*dev->getcur)(&x, &y) == ABORT) |
| 105 |
|
return(-1); |
| 106 |
< |
if (viewray(thisray.rorg, thisray.rdir, &ourview, |
| 107 |
< |
(x+.5)/hresolu, (y+.5)/vresolu) < 0) { |
| 106 |
> |
if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, |
| 107 |
> |
&ourview, (x+.5)/hresolu, (y+.5)/vresolu)) < -FTINY) { |
| 108 |
|
error(COMMAND, "not on image"); |
| 109 |
|
return(-1); |
| 110 |
|
} |
| 162 |
|
h = xmin + (xmax-xmin)*frandom(); |
| 163 |
|
v = ymin + (ymax-ymin)*frandom(); |
| 164 |
|
|
| 165 |
< |
if (viewray(thisray.rorg, thisray.rdir, &ourview, |
| 166 |
< |
h/hresolu, v/vresolu) < 0) { |
| 165 |
> |
if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, &ourview, |
| 166 |
> |
h/hresolu, v/vresolu)) < -FTINY) { |
| 167 |
|
setcolor(thisray.rcol, 0.0, 0.0, 0.0); |
| 168 |
|
} else { |
| 169 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
| 404 |
|
d = 0.0; /* don't move closer */ |
| 405 |
|
for (i = 0; i < 3; i++) |
| 406 |
|
d += (vc[i] - ourview.vp[i])*ourview.vdir[i]; |
| 407 |
+ |
nv.vfore = ourview.vfore; |
| 408 |
+ |
nv.vaft = ourview.vaft; |
| 409 |
|
} else { |
| 410 |
|
nv.horiz = ourview.horiz; |
| 411 |
|
nv.vert = ourview.vert; |
| 412 |
|
d = sqrt(dist2(ourview.vp, vc)) / mag; |
| 413 |
+ |
nv.vfore = ourview.vfore + d - d*mag; |
| 414 |
+ |
if (nv.vfore < 0.0) nv.vfore = 0.0; |
| 415 |
+ |
nv.vaft = ourview.vaft + d - d*mag; |
| 416 |
+ |
if (nv.vaft < nv.vfore) nv.vaft = 0.0; |
| 417 |
|
} |
| 418 |
|
for (i = 0; i < 3; i++) |
| 419 |
|
nv.vp[i] = vc[i] - d*nv.vdir[i]; |