1 |
< |
/* Copyright (c) 1992 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1995 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
251 |
|
chanvalue(n) /* return channel n to calcomp */ |
252 |
|
register int n; |
253 |
|
{ |
254 |
– |
double sum; |
255 |
– |
register RAY *r; |
256 |
– |
|
254 |
|
if (fray == NULL) |
255 |
|
syntax("ray parameter used in constant expression"); |
256 |
|
|
278 |
|
fray->rop[2]*funcxf.xfm[2][n-6] + |
279 |
|
funcxf.xfm[3][n-6] ); |
280 |
|
|
281 |
< |
if (n == 9) { /* total distance */ |
282 |
< |
sum = fray->rot; |
286 |
< |
for (r = fray->parent; r != NULL; r = r->parent) |
287 |
< |
sum += r->rot; |
288 |
< |
return(sum * funcxf.sca); |
281 |
> |
if (n == 9) /* total distance */ |
282 |
> |
return(raydist(fray,PRIMARY) * funcxf.sca); |
283 |
|
|
290 |
– |
} |
291 |
– |
|
284 |
|
if (n == 10) /* dot product (range [-1,1]) */ |
285 |
|
return( fray->rod <= -1.0 ? -1.0 : |
286 |
|
fray->rod >= 1.0 ? 1.0 : |
301 |
|
if (n < 24) /* k unit vector */ |
302 |
|
return(funcxf.xfm[2][n-21] / funcxf.sca); |
303 |
|
|
304 |
< |
if (n == 24) { /* single ray (shadow) distance */ |
305 |
< |
sum = fray->rot; |
314 |
< |
for (r = fray->parent; r != NULL && r->crtype&SHADOW; |
315 |
< |
r = r->parent) |
316 |
< |
sum += r->rot; |
317 |
< |
return(sum * funcxf.sca); |
318 |
< |
} |
304 |
> |
if (n == 24) /* single ray (shadow) distance */ |
305 |
> |
return((fray->rot+raydist(fray->parent,SHADOW)) * funcxf.sca); |
306 |
|
badchan: |
307 |
|
error(USER, "illegal channel number"); |
308 |
|
} |