| 1 |
– |
/* Copyright (c) 1999 Silicon Graphics, Inc. */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* Convert view to beam list. |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
+ |
#include <string.h> |
| 9 |
+ |
|
| 10 |
|
#include "rholo.h" |
| 11 |
|
#include "view.h" |
| 12 |
|
#include "random.h" |
| 26 |
|
static BEAMLIST blist; |
| 27 |
|
|
| 28 |
|
|
| 29 |
< |
static |
| 30 |
< |
add2blist(hd, bi, nr) /* add to beam sample list */ |
| 31 |
< |
int hd, bi, nr; |
| 29 |
> |
static void |
| 30 |
> |
add2blist( /* add to beam sample list */ |
| 31 |
> |
int hd, |
| 32 |
> |
int bi, |
| 33 |
> |
int nr |
| 34 |
> |
) |
| 35 |
|
{ |
| 36 |
< |
register int i; |
| 36 |
> |
int i; |
| 37 |
|
|
| 38 |
|
for (i = blist.nb; i--; ) |
| 39 |
|
if (blist.bl[i].bi == bi && blist.bl[i].hd == hd) { |
| 42 |
|
} |
| 43 |
|
i = blist.nb++; /* else add beam to list */ |
| 44 |
|
if (i % BALLOCBLK == 0) { |
| 45 |
< |
blist.bl = (PACKHEAD *)realloc((char *)blist.bl, |
| 45 |
> |
blist.bl = (PACKHEAD *)realloc((void *)blist.bl, |
| 46 |
|
(i+BALLOCBLK)*sizeof(PACKHEAD)); |
| 47 |
|
CHECK(blist.bl==NULL, SYSTEM, "out of memory in add2blist"); |
| 48 |
|
} |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
|
| 54 |
< |
int2 * |
| 55 |
< |
viewbeams(vp, hr, vr, blp) /* convert view into sections/beams */ |
| 56 |
< |
VIEW *vp; |
| 57 |
< |
int hr, vr; |
| 58 |
< |
BEAMLIST *blp; |
| 54 |
> |
int16 * |
| 55 |
> |
viewbeams( /* convert view into sections/beams */ |
| 56 |
> |
VIEW *vp, |
| 57 |
> |
int hr, |
| 58 |
> |
int vr, |
| 59 |
> |
BEAMLIST *blp |
| 60 |
> |
) |
| 61 |
|
{ |
| 62 |
< |
static int2 sectlist[HDMAX+1]; |
| 63 |
< |
int2 sectarr[MINRES+1][MINRES+1]; |
| 62 |
> |
static int16 sectlist[HDMAX+1]; |
| 63 |
> |
int16 sectarr[MINRES+1][MINRES+1]; |
| 64 |
|
double d0, d1, mindist; |
| 65 |
|
GCOORD gc[2]; |
| 66 |
|
FVECT rorg, rdir; |
| 67 |
|
int shr, svr, sampquant; |
| 68 |
|
int v; |
| 69 |
< |
register int h, hd; |
| 69 |
> |
int h, hd; |
| 70 |
|
/* clear section flags */ |
| 71 |
< |
bzero((char *)sectlist, sizeof(sectlist)); |
| 71 |
> |
memset((char *)sectlist, '\0', sizeof(sectlist)); |
| 72 |
|
/* identify view sections */ |
| 73 |
|
for (v = 0; v <= MINRES; v++) |
| 74 |
|
for (h = 0; h <= MINRES; h++) { |
| 145 |
|
/* add samples */ |
| 146 |
|
add2blist(hd, hdbindex(hdlist[hd],gc), sampquant); |
| 147 |
|
} |
| 148 |
< |
copystruct(blp, &blist); /* transfer beam list */ |
| 148 |
> |
*blp = blist; /* transfer beam list */ |
| 149 |
|
return(sectlist); /* all done! */ |
| 150 |
|
} |
| 151 |
|
|
| 152 |
|
|
| 153 |
|
int |
| 154 |
< |
nextview(vp, fp) /* get next view from fp */ |
| 155 |
< |
VIEW *vp; |
| 156 |
< |
FILE *fp; |
| 154 |
> |
nextview( /* get next view from fp */ |
| 155 |
> |
VIEW *vp, |
| 156 |
> |
FILE *fp |
| 157 |
> |
) |
| 158 |
|
{ |
| 159 |
|
char linebuf[256]; |
| 160 |
|
|