677 |
|
else |
678 |
|
fprintf(out, "5 "); |
679 |
|
fprintf(out, "%s %s source.cal ", |
680 |
< |
sinf->type==SPHERE ? "corr" : "flatcorr", |
680 |
> |
sinf->type==SPHERE ? "corr" : |
681 |
> |
sinf->type==DISK ? "cylcorr" : "boxcorr", |
682 |
|
libname(buf,name,T_DST)); |
683 |
|
if (pmtype == PM_B) { |
684 |
|
if (FEQ(bounds[1][0],0.)) |
701 |
|
} else |
702 |
|
fprintf(out, "src_theta "); |
703 |
|
} |
704 |
< |
fprintf(out, "\n0\n1 %g\n", sinf->mult); |
704 |
> |
if (sinf->type == SPHERE) |
705 |
> |
fprintf(out, "\n0\n1 %g\n", sinf->mult/sinf->area); |
706 |
> |
else if (sinf->type == DISK) |
707 |
> |
fprintf(out, "\n0\n3 %g %g %g\n", sinf->mult, |
708 |
> |
sinf->l, sinf->h); |
709 |
> |
else |
710 |
> |
fprintf(out, "\n0\n4 %g %g %g %g\n", sinf->mult, |
711 |
> |
sinf->l, sinf->w, sinf->h); |
712 |
|
if (putsource(sinf, out, id, filename(name), |
713 |
|
bounds[0][0]<90., bounds[0][1]>90.) != 0) |
714 |
|
return(-1); |
722 |
|
char *mod, *name; |
723 |
|
int dolower, doupper; |
724 |
|
{ |
725 |
< |
int dosides = 0; |
726 |
< |
char buf[MAXWORD]; |
725 |
> |
int dosides = doupper && dolower && shp->h > MINDIM; |
726 |
> |
char lname[MAXWORD]; |
727 |
|
|
728 |
< |
fprintf(fp, "\n%s %s %s_light\n", mod, |
729 |
< |
shp->isillum ? "illum" : "light", |
730 |
< |
name); |
728 |
> |
strcat(strcpy(lname, name), "_light"); |
729 |
> |
fprintf(fp, "\n%s %s %s\n", mod, |
730 |
> |
shp->isillum ? "illum" : "light", lname); |
731 |
|
fprintf(fp, "0\n0\n3 %g %g %g\n", |
732 |
< |
lampcolor[0]/shp->area, |
725 |
< |
lampcolor[1]/shp->area, |
726 |
< |
lampcolor[2]/shp->area); |
727 |
< |
if (doupper && dolower && shp->type != SPHERE && shp->h > MINDIM) |
728 |
< |
if (!shp->isillum) { |
729 |
< |
fprintf(fp, "\n%s glow %s_glow\n", mod, name); |
730 |
< |
fprintf(fp, "0\n0\n4 %g %g %g -1\n", |
731 |
< |
lampcolor[0]/shp->area, |
732 |
< |
lampcolor[1]/shp->area, |
733 |
< |
lampcolor[2]/shp->area); |
734 |
< |
dosides++; |
735 |
< |
} |
732 |
> |
lampcolor[0], lampcolor[1], lampcolor[2]); |
733 |
|
switch (shp->type) { |
734 |
|
case RECT: |
738 |
– |
strcat(strcpy(buf, name), "_light"); |
735 |
|
if (dolower) |
736 |
< |
putrectsrc(shp, fp, buf, name, 0); |
736 |
> |
putrectsrc(shp, fp, lname, name, 0); |
737 |
|
if (doupper) |
738 |
< |
putrectsrc(shp, fp, buf, name, 1); |
739 |
< |
if (dosides) { |
740 |
< |
strcat(strcpy(buf, name), "_glow"); |
745 |
< |
putsides(shp, fp, buf, name); |
746 |
< |
} |
738 |
> |
putrectsrc(shp, fp, lname, name, 1); |
739 |
> |
if (dosides) |
740 |
> |
putsides(shp, fp, lname, name); |
741 |
|
break; |
742 |
|
case DISK: |
749 |
– |
strcat(strcpy(buf, name), "_light"); |
743 |
|
if (dolower) |
744 |
< |
putdisksrc(shp, fp, buf, name, 0); |
744 |
> |
putdisksrc(shp, fp, lname, name, 0); |
745 |
|
if (doupper) |
746 |
< |
putdisksrc(shp, fp, buf, name, 1); |
747 |
< |
if (dosides) { |
748 |
< |
strcat(strcpy(buf, name), "_glow"); |
756 |
< |
putcyl(shp, fp, buf, name); |
757 |
< |
} |
746 |
> |
putdisksrc(shp, fp, lname, name, 1); |
747 |
> |
if (dosides) |
748 |
> |
putcyl(shp, fp, lname, name); |
749 |
|
break; |
750 |
|
case SPHERE: |
751 |
< |
strcat(strcpy(buf, name), "_light"); |
761 |
< |
putspheresrc(shp, fp, buf, name); |
751 |
> |
putspheresrc(shp, fp, lname, name); |
752 |
|
break; |
753 |
|
} |
754 |
|
return(0); |
968 |
|
getword(fp) /* scan a word from fp */ |
969 |
|
register FILE *fp; |
970 |
|
{ |
971 |
< |
static char word[MAXWORD]; |
971 |
> |
static char wrd[MAXWORD]; |
972 |
|
register char *cp; |
973 |
|
register int c; |
974 |
|
|
975 |
|
while (isspace(c=getc(fp))) |
976 |
|
; |
977 |
< |
for (cp = word; c != EOF && cp < word+MAXWORD-1; |
977 |
> |
for (cp = wrd; c != EOF && cp < wrd+MAXWORD-1; |
978 |
|
*cp++ = c, c = getc(fp)) |
979 |
|
if (isspace(c) || c == ',') { |
980 |
|
while (isspace(c)) |
982 |
|
if (c != EOF & c != ',') |
983 |
|
ungetc(c, fp); |
984 |
|
*cp = '\0'; |
985 |
< |
return(word); |
985 |
> |
return(wrd); |
986 |
|
} |
987 |
|
*cp = '\0'; |
988 |
< |
return(cp > word ? word : NULL); |
988 |
> |
return(cp > wrd ? wrd : NULL); |
989 |
|
} |
990 |
|
|
991 |
|
|
992 |
< |
cvtint(ip, word) /* convert a word to an integer */ |
992 |
> |
cvtint(ip, wrd) /* convert a word to an integer */ |
993 |
|
int *ip; |
994 |
< |
char *word; |
994 |
> |
char *wrd; |
995 |
|
{ |
996 |
< |
if (word == NULL || !isint(word)) |
996 |
> |
if (wrd == NULL || !isint(wrd)) |
997 |
|
return(0); |
998 |
< |
*ip = atoi(word); |
998 |
> |
*ip = atoi(wrd); |
999 |
|
return(1); |
1000 |
|
} |
1001 |
|
|
1002 |
|
|
1003 |
< |
cvtflt(rp, word) /* convert a word to a double */ |
1003 |
> |
cvtflt(rp, wrd) /* convert a word to a double */ |
1004 |
|
double *rp; |
1005 |
< |
char *word; |
1005 |
> |
char *wrd; |
1006 |
|
{ |
1007 |
< |
if (word == NULL || !isflt(word)) |
1007 |
> |
if (wrd == NULL || !isflt(wrd)) |
1008 |
|
return(0); |
1009 |
< |
*rp = atof(word); |
1009 |
> |
*rp = atof(wrd); |
1010 |
|
return(1); |
1011 |
|
} |
1012 |
|
|