--- ray/src/common/falsecolor.c 2006/01/26 03:13:36 3.6 +++ ray/src/common/falsecolor.c 2008/07/03 03:35:10 3.9 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: falsecolor.c,v 3.6 2006/01/26 03:13:36 greg Exp $"; +static const char RCSid[] = "$Id: falsecolor.c,v 3.9 2008/07/03 03:35:10 greg Exp $"; #endif /* * False color mapping functions. @@ -88,9 +88,9 @@ fcLinearMapping(FCstruct *fcs, TMstruct *tms, double p if ((fcs == NULL) | (tms == NULL) || (tms->histo == NULL) | (0 > pctile) | (pctile >= 50)) return(TM_E_ILLEGAL); - i = (tms->hbrmin-MINBRT)/HISTEP; - brt0 = MINBRT + HISTEP/2 + i*HISTEP; - histlen = (tms->hbrmax-MINBRT)/HISTEP + 1 - i; + i = HISTI(tms->hbrmin); + brt0 = HISTV(i); + histlen = HISTI(tms->hbrmax) + 1 - i; histot = 0; for (i = histlen; i--; ) histot += tms->histo[i]; @@ -114,9 +114,9 @@ fcLogMapping(FCstruct *fcs, TMstruct *tms, double pcti if ((fcs == NULL) | (tms == NULL) || (tms->histo == NULL) | (.0 > pctile) | (pctile >= 50.)) return(TM_E_ILLEGAL); - i = (tms->hbrmin-MINBRT)/HISTEP; - brt0 = MINBRT + HISTEP/2 + i*HISTEP; - histlen = (tms->hbrmax-MINBRT)/HISTEP + 1 - i; + i = HISTI(tms->hbrmin); + brt0 = HISTV(i); + histlen = HISTI(tms->hbrmax) + 1 - i; histot = 0; for (i = histlen; i--; ) histot += tms->histo[i]; @@ -170,9 +170,9 @@ fcIsLogMap(FCstruct *fcs) if (fcs == NULL || fcs->lumap == NULL) return(-1); - miderr = fcs->lumap[(fcs->mbrmax - fcs->mbrmin)/2] - - 128L * (fcs->mbrmax - fcs->mbrmin) / - (fcs->mbrmax - fcs->mbrmin + 1); + miderr = (fcs->mbrmax - fcs->mbrmin)/2; + miderr = fcs->lumap[miderr] - + 256L * miderr / (fcs->mbrmax - fcs->mbrmin + 1); return((-1 <= miderr) & (miderr <= 1)); }