| 1 |
|
#ifndef lint |
| 2 |
< |
static const char RCSid[] = "$Id"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 4 |
|
/* |
| 5 |
|
* Routines to print mkillum objects |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
|
#include "mkillum.h" |
| 9 |
+ |
#include "paths.h" |
| 10 |
|
|
| 11 |
|
#define brt(col) (.263*(col)[0]+.655*(col)[1]+.082*(col)[2]) |
| 12 |
|
|
| 15 |
|
char DSTSUF[] = ".dist"; /* distribution suffix */ |
| 16 |
|
char FNCFNM[] = "illum.cal"; /* function file name */ |
| 17 |
|
|
| 18 |
+ |
void compinv(float *rinv, float *rp, int m); |
| 19 |
+ |
void colorout(int p, float *da, int n, int m, double mult, FILE *fp); |
| 20 |
+ |
void fputnum(double d, FILE *fp); |
| 21 |
+ |
void brightout(float *da, int n, int m, double mult, FILE *fp); |
| 22 |
+ |
void fputeol(FILE *fp); |
| 23 |
+ |
void compavg(float col[3], float *da, int n); |
| 24 |
+ |
char * dfname(struct illum_args *il, int c); |
| 25 |
+ |
FILE * dfopen(struct illum_args *il, int c); |
| 26 |
|
|
| 27 |
< |
printobj(mod, obj) /* print out an object */ |
| 28 |
< |
char *mod; |
| 29 |
< |
register OBJREC *obj; |
| 27 |
> |
|
| 28 |
> |
void |
| 29 |
> |
printobj( /* print out an object */ |
| 30 |
> |
char *mod, |
| 31 |
> |
register OBJREC *obj |
| 32 |
> |
) |
| 33 |
|
{ |
| 34 |
|
register int i; |
| 35 |
|
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
char * |
| 60 |
< |
dfname(il, c) /* return data file name */ |
| 61 |
< |
struct illum_args *il; |
| 62 |
< |
int c; |
| 60 |
> |
dfname( /* return data file name */ |
| 61 |
> |
struct illum_args *il, |
| 62 |
> |
int c |
| 63 |
> |
) |
| 64 |
|
{ |
| 65 |
|
char fname[MAXSTR]; |
| 66 |
|
register char *s; |
| 78 |
|
|
| 79 |
|
|
| 80 |
|
FILE * |
| 81 |
< |
dfopen(il, c) /* open data file */ |
| 82 |
< |
register struct illum_args *il; |
| 83 |
< |
int c; |
| 81 |
> |
dfopen( /* open data file */ |
| 82 |
> |
register struct illum_args *il, |
| 83 |
> |
int c |
| 84 |
> |
) |
| 85 |
|
{ |
| 86 |
|
char *fn; |
| 87 |
|
FILE *fp; |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
|
| 102 |
< |
flatout(il, da, n, m, u, v, w) /* write hemispherical distribution */ |
| 103 |
< |
struct illum_args *il; |
| 104 |
< |
float *da; |
| 105 |
< |
int n, m; |
| 106 |
< |
FVECT u, v, w; |
| 102 |
> |
extern void |
| 103 |
> |
flatout( /* write hemispherical distribution */ |
| 104 |
> |
struct illum_args *il, |
| 105 |
> |
float *da, |
| 106 |
> |
int n, |
| 107 |
> |
int m, |
| 108 |
> |
FVECT u, |
| 109 |
> |
FVECT v, |
| 110 |
> |
FVECT w |
| 111 |
> |
) |
| 112 |
|
{ |
| 113 |
|
float *Ninv; |
| 114 |
|
FILE *dfp; |
| 156 |
|
} |
| 157 |
|
|
| 158 |
|
|
| 159 |
< |
roundout(il, da, n, m) /* write spherical distribution */ |
| 160 |
< |
struct illum_args *il; |
| 161 |
< |
float *da; |
| 162 |
< |
int n, m; |
| 159 |
> |
extern void |
| 160 |
> |
roundout( /* write spherical distribution */ |
| 161 |
> |
struct illum_args *il, |
| 162 |
> |
float *da, |
| 163 |
> |
int n, |
| 164 |
> |
int m |
| 165 |
> |
) |
| 166 |
|
{ |
| 167 |
|
float *Ninv, *Sinv; |
| 168 |
|
FILE *dfp; |
| 212 |
|
} |
| 213 |
|
|
| 214 |
|
|
| 215 |
< |
illumout(il, ob) /* print illum object */ |
| 216 |
< |
register struct illum_args *il; |
| 217 |
< |
OBJREC *ob; |
| 215 |
> |
extern void |
| 216 |
> |
illumout( /* print illum object */ |
| 217 |
> |
register struct illum_args *il, |
| 218 |
> |
OBJREC *ob |
| 219 |
> |
) |
| 220 |
|
{ |
| 221 |
|
double cout[3]; |
| 222 |
|
|
| 243 |
|
} |
| 244 |
|
|
| 245 |
|
|
| 246 |
< |
compavg(col, da, n) /* compute average for set of data values */ |
| 247 |
< |
float col[3]; |
| 248 |
< |
register float *da; |
| 249 |
< |
int n; |
| 246 |
> |
void |
| 247 |
> |
compavg( /* compute average for set of data values */ |
| 248 |
> |
float col[3], |
| 249 |
> |
register float *da, |
| 250 |
> |
int n |
| 251 |
> |
) |
| 252 |
|
{ |
| 253 |
|
register int i; |
| 254 |
|
|
| 264 |
|
} |
| 265 |
|
|
| 266 |
|
|
| 267 |
< |
compinv(rinv, rp, m) /* compute other side of row average */ |
| 268 |
< |
register float *rinv, *rp; |
| 269 |
< |
int m; |
| 267 |
> |
void |
| 268 |
> |
compinv( /* compute other side of row average */ |
| 269 |
> |
register float *rinv, |
| 270 |
> |
register float *rp, |
| 271 |
> |
int m |
| 272 |
> |
) |
| 273 |
|
{ |
| 274 |
|
float avg[3]; |
| 275 |
|
|
| 282 |
|
} |
| 283 |
|
|
| 284 |
|
|
| 285 |
< |
average(il, da, n) /* evaluate average value for distribution */ |
| 286 |
< |
register struct illum_args *il; |
| 287 |
< |
float *da; |
| 288 |
< |
int n; |
| 285 |
> |
extern int |
| 286 |
> |
average( /* evaluate average value for distribution */ |
| 287 |
> |
register struct illum_args *il, |
| 288 |
> |
float *da, |
| 289 |
> |
int n |
| 290 |
> |
) |
| 291 |
|
{ |
| 292 |
|
compavg(il->col, da, n); /* average */ |
| 293 |
|
if (il->nsamps > 1) { |
| 302 |
|
|
| 303 |
|
static int colmcnt = 0; /* count of columns written */ |
| 304 |
|
|
| 305 |
< |
fputnum(d, fp) /* put out a number to fp */ |
| 306 |
< |
double d; |
| 307 |
< |
FILE *fp; |
| 305 |
> |
void |
| 306 |
> |
fputnum( /* put out a number to fp */ |
| 307 |
> |
double d, |
| 308 |
> |
FILE *fp |
| 309 |
> |
) |
| 310 |
|
{ |
| 311 |
|
if (colmcnt++ % 5 == 0) |
| 312 |
|
putc('\n', fp); |
| 314 |
|
} |
| 315 |
|
|
| 316 |
|
|
| 317 |
< |
fputeol(fp) /* write end of line to fp */ |
| 318 |
< |
register FILE *fp; |
| 317 |
> |
void |
| 318 |
> |
fputeol( /* write end of line to fp */ |
| 319 |
> |
register FILE *fp |
| 320 |
> |
) |
| 321 |
|
{ |
| 322 |
|
putc('\n', fp); |
| 323 |
|
colmcnt = 0; |
| 324 |
|
} |
| 325 |
|
|
| 326 |
|
|
| 327 |
< |
colorout(p, da, n, m, mult, fp) /* put out color distribution data */ |
| 328 |
< |
int p; |
| 329 |
< |
register float *da; |
| 330 |
< |
int n, m; |
| 331 |
< |
double mult; |
| 332 |
< |
FILE *fp; |
| 327 |
> |
void |
| 328 |
> |
colorout( /* put out color distribution data */ |
| 329 |
> |
int p, |
| 330 |
> |
register float *da, |
| 331 |
> |
int n, |
| 332 |
> |
int m, |
| 333 |
> |
double mult, |
| 334 |
> |
FILE *fp |
| 335 |
> |
) |
| 336 |
|
{ |
| 337 |
|
register int i, j; |
| 338 |
|
|
| 346 |
|
} |
| 347 |
|
|
| 348 |
|
|
| 349 |
< |
brightout(da, n, m, mult, fp) /* put out brightness distribution data */ |
| 350 |
< |
register float *da; |
| 351 |
< |
int n, m; |
| 352 |
< |
double mult; |
| 353 |
< |
FILE *fp; |
| 349 |
> |
void |
| 350 |
> |
brightout( /* put out brightness distribution data */ |
| 351 |
> |
register float *da, |
| 352 |
> |
int n, |
| 353 |
> |
int m, |
| 354 |
> |
double mult, |
| 355 |
> |
FILE *fp |
| 356 |
> |
) |
| 357 |
|
{ |
| 358 |
|
register int i, j; |
| 359 |
|
|