| 1 |
– |
/* Copyright (c) 1991 Regents of the University of California */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* Routines to do the actual calculation for mkillum |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
< |
#include "mkillum.h" |
| 8 |
> |
#include <string.h> |
| 9 |
|
|
| 10 |
+ |
#include "mkillum.h" |
| 11 |
|
#include "face.h" |
| 14 |
– |
|
| 12 |
|
#include "cone.h" |
| 16 |
– |
|
| 13 |
|
#include "random.h" |
| 14 |
|
|
| 15 |
|
|
| 114 |
|
objerror(ob, WARNING, "bad aspect"); |
| 115 |
|
rt->nrays = 0; |
| 116 |
|
freeface(ob); |
| 117 |
< |
free((char *)distarr); |
| 117 |
> |
free((void *)distarr); |
| 118 |
|
o_default(ob, il, rt, nm); |
| 119 |
|
return; |
| 120 |
|
} |
| 133 |
|
printobj(il->altmat, ob); |
| 134 |
|
/* clean up */ |
| 135 |
|
freeface(ob); |
| 136 |
< |
free((char *)distarr); |
| 136 |
> |
free((void *)distarr); |
| 137 |
|
#undef MAXMISS |
| 138 |
|
} |
| 139 |
|
|
| 159 |
|
nalt = nazi = 1; |
| 160 |
|
else { |
| 161 |
|
n = 4.*PI * il->sampdens; |
| 162 |
< |
nalt = sqrt(n/PI) + .5; |
| 163 |
< |
nazi = PI*nalt + .5; |
| 162 |
> |
nalt = sqrt(2./PI*n) + .5; |
| 163 |
> |
nazi = PI/2.*nalt + .5; |
| 164 |
|
} |
| 165 |
|
n = nalt*nazi; |
| 166 |
|
distarr = (float *)calloc(n, 3*sizeof(float)); |
| 203 |
|
} else |
| 204 |
|
printobj(il->altmat, ob); |
| 205 |
|
/* clean up */ |
| 206 |
< |
free((char *)distarr); |
| 206 |
> |
free((void *)distarr); |
| 207 |
|
} |
| 208 |
|
|
| 209 |
|
|
| 272 |
|
printobj(il->altmat, ob); |
| 273 |
|
/* clean up */ |
| 274 |
|
freecone(ob); |
| 275 |
< |
free((char *)distarr); |
| 275 |
> |
free((void *)distarr); |
| 276 |
|
} |
| 277 |
|
|
| 278 |
|
|
| 299 |
|
|
| 300 |
|
if (rt->nrays <= 0) |
| 301 |
|
return; |
| 302 |
< |
bzero(rt->buf+6*rt->nrays, 6*sizeof(float)); |
| 302 |
> |
memset(rt->buf+6*rt->nrays, '\0', 6*sizeof(float)); |
| 303 |
|
errno = 0; |
| 304 |
< |
if ( process(rt->pd, (char *)rt->buf, (char *)rt->buf, |
| 305 |
< |
3*sizeof(float)*rt->nrays, |
| 304 |
> |
if ( process(&(rt->pd), (char *)rt->buf, (char *)rt->buf, |
| 305 |
> |
3*sizeof(float)*(rt->nrays+1), |
| 306 |
|
6*sizeof(float)*(rt->nrays+1)) < |
| 307 |
< |
3*sizeof(float)*rt->nrays ) |
| 307 |
> |
3*sizeof(float)*(rt->nrays+1) ) |
| 308 |
|
error(SYSTEM, "error reading from rtrace process"); |
| 309 |
|
i = rt->nrays; |
| 310 |
|
while (i--) { |