--- ray/src/hd/holo.c 1998/12/03 15:18:39 3.15 +++ ray/src/hd/holo.c 2003/07/21 22:30:18 3.19 @@ -1,9 +1,6 @@ -/* Copyright (c) 1998 Silicon Graphics, Inc. */ - #ifndef lint -static char SCCSid[] = "$SunId$ SGI"; +static const char RCSid[] = "$Id: holo.c,v 3.19 2003/07/21 22:30:18 schorsch Exp $"; #endif - /* * Routines for converting holodeck coordinates, etc. * @@ -57,40 +54,6 @@ register HOLO *hp; } -HOLO * -hdalloc(hproto) /* allocate and set holodeck section based on grid */ -HDGRID *hproto; -{ - HOLO hdhead; - register HOLO *hp; - int n; - /* copy grid to temporary header */ - bcopy((char *)hproto, (char *)&hdhead, sizeof(HDGRID)); - /* compute grid vectors and sizes */ - hdcompgrid(&hdhead); - /* allocate header with directory */ - n = sizeof(HOLO)+nbeams(&hdhead)*sizeof(BEAMI); - if ((hp = (HOLO *)malloc(n)) == NULL) - return(NULL); - /* copy header information */ - copystruct(hp, &hdhead); - /* allocate and clear beam list */ - hp->bl = (BEAM **)malloc((nbeams(hp)+1)*sizeof(BEAM *)+sizeof(BEAM)); - if (hp->bl == NULL) { - free((char *)hp); - return(NULL); - } - bzero((char *)hp->bl, (nbeams(hp)+1)*sizeof(BEAM *)+sizeof(BEAM)); - hp->bl[0] = (BEAM *)(hp->bl+nbeams(hp)+1); /* set blglob(hp) */ - hp->fd = -1; - hp->dirty = 0; - hp->priv = NULL; - /* clear beam directory */ - bzero((char *)hp->bi, (nbeams(hp)+1)*sizeof(BEAMI)); - return(hp); /* all is well */ -} - - hdbcoord(gc, hp, i) /* compute beam coordinates from index */ GCOORD gc[2]; /* returned */ register HOLO *hp; @@ -127,9 +90,9 @@ register int i; gc[1].i[1] = i / hp->grid[hdwg0[gc[1].w]]; gc[1].i[0] = i - gc[1].i[1]*hp->grid[hdwg0[gc[1].w]]; if (reverse) { - copystruct(g2, gc+1); - copystruct(gc+1, gc); - copystruct(gc, g2); + *g2 = *(gc+1); + *(gc+1) = *gc; + *gc = *g2; } return(1); /* we're done */ } @@ -145,8 +108,8 @@ register GCOORD gc[2]; register int i, j; /* check ordering and limits */ if (reverse = gc[0].w > gc[1].w) { - copystruct(g2, gc+1); - copystruct(g2+1, gc); + *g2 = *(gc+1); + *(g2+1) = *gc; gc = g2; } else if (gc[0].w == gc[1].w) return(0); @@ -171,7 +134,7 @@ register FVECT cp[4]; /* returned (may be passed as FV register HOLO *hp; register GCOORD *gc; { - register FLOAT *v; + register RREAL *v; double d; /* compute common component */ VCOPY(cp[0], hp->orig); @@ -300,7 +263,7 @@ FVECT ro, rd; /* normalization of rd affects distance { FVECT p[2], vt; double d, t0, t1, d0, d1; - register FLOAT *v; + register RREAL *v; register int i; /* first, intersect walls */ gc[0].w = gc[1].w = -1;