--- ray/src/common/spec_rgb.c 2007/10/08 18:07:55 2.16 +++ ray/src/common/spec_rgb.c 2010/04/12 21:24:07 2.21 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: spec_rgb.c,v 2.16 2007/10/08 18:07:55 greg Exp $"; +static const char RCSid[] = "$Id: spec_rgb.c,v 2.21 2010/04/12 21:24:07 greg Exp $"; #endif /* * Convert colors and spectral ranges. @@ -241,14 +241,23 @@ colorprimsOK( /* are color primaries reasonable? */ RGBPRIMS pr ) { - int i; + int i, j; for (i = 0; i < 4; i++) { - if ((pr[i][CIEX] <= CEPS) | (pr[i][CIEY] <= CEPS)) + if ((pr[i][CIEX] <= -1.) | (pr[i][CIEY] <= -1.)) return(0); - if ((pr[i][CIEX] >= 1.-CEPS) | (pr[i][CIEY] >= 1.-CEPS)) + if ((pr[i][CIEX] >= 2.) | (pr[i][CIEY] >= 2.)) return(0); + if (pr[i][CIEX] + pr[i][CIEY] <= -1.) + return(0); + if (pr[i][CIEX] + pr[i][CIEY] >= 2.) + return(0); } + for (i = 0; i < 4; i++) + for (j = i+1; j < 4; j++) + if (CEQ(pr[i][CIEX],pr[j][CIEX]) && + CEQ(pr[i][CIEY],pr[j][CIEY])) + return(0); return(1); }