| 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 print mkillum objects |
| 6 |
|
*/ |
| 14 |
|
char DSTSUF[] = ".dist"; /* distribution suffix */ |
| 15 |
|
char FNCFNM[] = "illum.cal"; /* function file name */ |
| 16 |
|
|
| 17 |
+ |
void compinv(float *rinv, float *rp, int m); |
| 18 |
+ |
void colorout(int p, float *da, int n, int m, double mult, FILE *fp); |
| 19 |
+ |
void fputnum(double d, FILE *fp); |
| 20 |
+ |
void brightout(float *da, int n, int m, double mult, FILE *fp); |
| 21 |
+ |
void fputeol(FILE *fp); |
| 22 |
+ |
void compavg(float col[3], float *da, int n); |
| 23 |
+ |
char * dfname(struct illum_args *il, int c); |
| 24 |
+ |
FILE * dfopen(struct illum_args *il, int c); |
| 25 |
|
|
| 26 |
< |
printobj(mod, obj) /* print out an object */ |
| 27 |
< |
char *mod; |
| 28 |
< |
register OBJREC *obj; |
| 26 |
> |
|
| 27 |
> |
void |
| 28 |
> |
printobj( /* print out an object */ |
| 29 |
> |
char *mod, |
| 30 |
> |
register OBJREC *obj |
| 31 |
> |
) |
| 32 |
|
{ |
| 33 |
|
register int i; |
| 34 |
|
|
| 56 |
|
|
| 57 |
|
|
| 58 |
|
char * |
| 59 |
< |
dfname(il, c) /* return data file name */ |
| 60 |
< |
struct illum_args *il; |
| 61 |
< |
int c; |
| 59 |
> |
dfname( /* return data file name */ |
| 60 |
> |
struct illum_args *il, |
| 61 |
> |
int c |
| 62 |
> |
) |
| 63 |
|
{ |
| 55 |
– |
extern char *getpath(), *strcpy(); |
| 64 |
|
char fname[MAXSTR]; |
| 65 |
|
register char *s; |
| 66 |
|
|
| 77 |
|
|
| 78 |
|
|
| 79 |
|
FILE * |
| 80 |
< |
dfopen(il, c) /* open data file */ |
| 81 |
< |
register struct illum_args *il; |
| 82 |
< |
int c; |
| 80 |
> |
dfopen( /* open data file */ |
| 81 |
> |
register struct illum_args *il, |
| 82 |
> |
int c |
| 83 |
> |
) |
| 84 |
|
{ |
| 85 |
|
char *fn; |
| 86 |
|
FILE *fp; |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
|
| 101 |
< |
flatout(il, da, n, m, u, v, w) /* write hemispherical distribution */ |
| 102 |
< |
struct illum_args *il; |
| 103 |
< |
float *da; |
| 104 |
< |
int n, m; |
| 105 |
< |
FVECT u, v, w; |
| 101 |
> |
extern void |
| 102 |
> |
flatout( /* write hemispherical distribution */ |
| 103 |
> |
struct illum_args *il, |
| 104 |
> |
float *da, |
| 105 |
> |
int n, |
| 106 |
> |
int m, |
| 107 |
> |
FVECT u, |
| 108 |
> |
FVECT v, |
| 109 |
> |
FVECT w |
| 110 |
> |
) |
| 111 |
|
{ |
| 112 |
|
float *Ninv; |
| 113 |
|
FILE *dfp; |
| 136 |
|
il->matname, DSTSUF); |
| 137 |
|
printf("\n5 noneg"); |
| 138 |
|
dfp = dfopen(il, 0); |
| 139 |
< |
fprintf(dfp, "2\n%f %f %d\n%f %f %d\n", 1.+.5/n, .5/n, n+1, |
| 139 |
> |
fprintf(dfp, "2\n%f %f %d\n%f %f %d\n", |
| 140 |
> |
1.+.5/n, .5/n, n+1, |
| 141 |
|
0., 2.*PI, m+1); |
| 142 |
|
brightout(Ninv, 1, m, 1./il->nsamps/brt(il->col), dfp); |
| 143 |
|
brightout(da, n, m, 1./il->nsamps/brt(il->col), dfp); |
| 151 |
|
printf("\t%f\t%f\t%f\n", v[0], v[1], v[2]); |
| 152 |
|
printf("\t%f\t%f\t%f\n", w[0], w[1], w[2]); |
| 153 |
|
il->dfnum++; |
| 154 |
< |
free((char *)Ninv); |
| 154 |
> |
free((void *)Ninv); |
| 155 |
|
} |
| 156 |
|
|
| 157 |
|
|
| 158 |
< |
roundout(il, da, n, m) /* write spherical distribution */ |
| 159 |
< |
struct illum_args *il; |
| 160 |
< |
float *da; |
| 161 |
< |
int n, m; |
| 158 |
> |
extern void |
| 159 |
> |
roundout( /* write spherical distribution */ |
| 160 |
> |
struct illum_args *il, |
| 161 |
> |
float *da, |
| 162 |
> |
int n, |
| 163 |
> |
int m |
| 164 |
> |
) |
| 165 |
|
{ |
| 166 |
|
float *Ninv, *Sinv; |
| 167 |
|
FILE *dfp; |
| 169 |
|
|
| 170 |
|
if ((Ninv = (float *)malloc(3*m*sizeof(float))) == NULL || |
| 171 |
|
(Sinv = (float *)malloc(3*m*sizeof(float))) == NULL) |
| 172 |
< |
error(SYSTEM, "out of memory in flatout"); |
| 172 |
> |
error(SYSTEM, "out of memory in roundout"); |
| 173 |
|
compinv(Ninv, da, m); |
| 174 |
|
compinv(Sinv, da+3*m*(n-1), m); |
| 175 |
|
if (il->flags & IL_COLDST) { |
| 193 |
|
il->matname, DSTSUF); |
| 194 |
|
printf("\n5 noneg"); |
| 195 |
|
dfp = dfopen(il, 0); |
| 196 |
< |
fprintf(dfp, "2\n%f %f %d\n%f %f %d\n", 1.-1./n, -1.+1./n, n, |
| 196 |
> |
fprintf(dfp, "2\n%f %f %d\n%f %f %d\n", |
| 197 |
> |
1.+1./n, -1.-1./n, n+2, |
| 198 |
|
0., 2.*PI, m+1); |
| 199 |
|
brightout(Ninv, 1, m, 1./il->nsamps/brt(il->col), dfp); |
| 200 |
|
brightout(da, n, m, 1./il->nsamps/brt(il->col), dfp); |
| 206 |
|
printf("\n\t%s il_alt il_azi", FNCFNM); |
| 207 |
|
printf("\n0\n0\n"); |
| 208 |
|
il->dfnum++; |
| 209 |
< |
free((char *)Ninv); |
| 210 |
< |
free((char *)Sinv); |
| 209 |
> |
free((void *)Ninv); |
| 210 |
> |
free((void *)Sinv); |
| 211 |
|
} |
| 212 |
|
|
| 213 |
|
|
| 214 |
< |
illumout(il, ob) /* print illum object */ |
| 215 |
< |
register struct illum_args *il; |
| 216 |
< |
OBJREC *ob; |
| 214 |
> |
extern void |
| 215 |
> |
illumout( /* print illum object */ |
| 216 |
> |
register struct illum_args *il, |
| 217 |
> |
OBJREC *ob |
| 218 |
> |
) |
| 219 |
|
{ |
| 220 |
|
double cout[3]; |
| 221 |
|
|
| 242 |
|
} |
| 243 |
|
|
| 244 |
|
|
| 245 |
< |
compavg(col, da, n) /* compute average for set of data values */ |
| 246 |
< |
float col[3]; |
| 247 |
< |
register float *da; |
| 248 |
< |
int n; |
| 245 |
> |
void |
| 246 |
> |
compavg( /* compute average for set of data values */ |
| 247 |
> |
float col[3], |
| 248 |
> |
register float *da, |
| 249 |
> |
int n |
| 250 |
> |
) |
| 251 |
|
{ |
| 252 |
|
register int i; |
| 253 |
|
|
| 263 |
|
} |
| 264 |
|
|
| 265 |
|
|
| 266 |
< |
compinv(rinv, rp, m) /* compute other side of row average */ |
| 267 |
< |
register float *rinv, *rp; |
| 268 |
< |
int m; |
| 266 |
> |
void |
| 267 |
> |
compinv( /* compute other side of row average */ |
| 268 |
> |
register float *rinv, |
| 269 |
> |
register float *rp, |
| 270 |
> |
int m |
| 271 |
> |
) |
| 272 |
|
{ |
| 273 |
|
float avg[3]; |
| 274 |
|
|
| 281 |
|
} |
| 282 |
|
|
| 283 |
|
|
| 284 |
< |
average(il, da, n) /* evaluate average value for distribution */ |
| 285 |
< |
register struct illum_args *il; |
| 286 |
< |
float *da; |
| 287 |
< |
int n; |
| 284 |
> |
extern int |
| 285 |
> |
average( /* evaluate average value for distribution */ |
| 286 |
> |
register struct illum_args *il, |
| 287 |
> |
float *da, |
| 288 |
> |
int n |
| 289 |
> |
) |
| 290 |
|
{ |
| 291 |
|
compavg(il->col, da, n); /* average */ |
| 292 |
|
if (il->nsamps > 1) { |
| 301 |
|
|
| 302 |
|
static int colmcnt = 0; /* count of columns written */ |
| 303 |
|
|
| 304 |
< |
fputnum(d, fp) /* put out a number to fp */ |
| 305 |
< |
double d; |
| 306 |
< |
FILE *fp; |
| 304 |
> |
void |
| 305 |
> |
fputnum( /* put out a number to fp */ |
| 306 |
> |
double d, |
| 307 |
> |
FILE *fp |
| 308 |
> |
) |
| 309 |
|
{ |
| 310 |
|
if (colmcnt++ % 5 == 0) |
| 311 |
|
putc('\n', fp); |
| 313 |
|
} |
| 314 |
|
|
| 315 |
|
|
| 316 |
< |
fputeol(fp) /* write end of line to fp */ |
| 317 |
< |
register FILE *fp; |
| 316 |
> |
void |
| 317 |
> |
fputeol( /* write end of line to fp */ |
| 318 |
> |
register FILE *fp |
| 319 |
> |
) |
| 320 |
|
{ |
| 321 |
|
putc('\n', fp); |
| 322 |
|
colmcnt = 0; |
| 323 |
|
} |
| 324 |
|
|
| 325 |
|
|
| 326 |
< |
colorout(p, da, n, m, mult, fp) /* put out color distribution data */ |
| 327 |
< |
int p; |
| 328 |
< |
register float *da; |
| 329 |
< |
int n, m; |
| 330 |
< |
double mult; |
| 331 |
< |
FILE *fp; |
| 326 |
> |
void |
| 327 |
> |
colorout( /* put out color distribution data */ |
| 328 |
> |
int p, |
| 329 |
> |
register float *da, |
| 330 |
> |
int n, |
| 331 |
> |
int m, |
| 332 |
> |
double mult, |
| 333 |
> |
FILE *fp |
| 334 |
> |
) |
| 335 |
|
{ |
| 336 |
|
register int i, j; |
| 337 |
|
|
| 345 |
|
} |
| 346 |
|
|
| 347 |
|
|
| 348 |
< |
brightout(da, n, m, mult, fp) /* put out brightness distribution data */ |
| 349 |
< |
register float *da; |
| 350 |
< |
int n, m; |
| 351 |
< |
double mult; |
| 352 |
< |
FILE *fp; |
| 348 |
> |
void |
| 349 |
> |
brightout( /* put out brightness distribution data */ |
| 350 |
> |
register float *da, |
| 351 |
> |
int n, |
| 352 |
> |
int m, |
| 353 |
> |
double mult, |
| 354 |
> |
FILE *fp |
| 355 |
> |
) |
| 356 |
|
{ |
| 357 |
|
register int i, j; |
| 358 |
|
|