| 1 |
< |
/* Copyright (c) 1986 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1990 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 230 |
|
newdot = -newdot; |
| 231 |
|
} |
| 232 |
|
return(newdot); |
| 233 |
+ |
} |
| 234 |
+ |
|
| 235 |
+ |
|
| 236 |
+ |
newrayxf(r) /* get new tranformation matrix for ray */ |
| 237 |
+ |
RAY *r; |
| 238 |
+ |
{ |
| 239 |
+ |
static struct xfn { |
| 240 |
+ |
struct xfn *next; |
| 241 |
+ |
FULLXF xf; |
| 242 |
+ |
} xfseed = { &xfseed }, *xflast = &xfseed; |
| 243 |
+ |
register struct xfn *xp; |
| 244 |
+ |
register RAY *rp; |
| 245 |
+ |
|
| 246 |
+ |
/* |
| 247 |
+ |
* Search for transform in circular list that |
| 248 |
+ |
* has no associated ray in the tree. |
| 249 |
+ |
*/ |
| 250 |
+ |
xp = xflast; |
| 251 |
+ |
for (rp = r->parent; rp != NULL; rp = rp->parent) |
| 252 |
+ |
if (rp->rox == &xp->xf) { /* xp in use */ |
| 253 |
+ |
xp = xp->next; /* move to next */ |
| 254 |
+ |
if (xp == xflast) { /* need new one */ |
| 255 |
+ |
xp = (struct xfn *)bmalloc(sizeof(struct xfn)); |
| 256 |
+ |
if (xp == NULL) |
| 257 |
+ |
error(SYSTEM, |
| 258 |
+ |
"out of memory in newrayxf"); |
| 259 |
+ |
/* insert in list */ |
| 260 |
+ |
xp->next = xflast->next; |
| 261 |
+ |
xflast->next = xp; |
| 262 |
+ |
break; /* we're done */ |
| 263 |
+ |
} |
| 264 |
+ |
rp = r; /* start check over */ |
| 265 |
+ |
} |
| 266 |
+ |
/* got it */ |
| 267 |
+ |
r->rox = &xp->xf; |
| 268 |
+ |
xflast = xp; |
| 269 |
|
} |
| 270 |
|
|
| 271 |
|
|