--- ray/src/rt/srcsupp.c 1991/06/20 13:44:36 1.1 +++ ray/src/rt/srcsupp.c 1991/06/21 13:23:05 1.3 @@ -44,7 +44,7 @@ initstypes() /* initialize source dispatch table */ } -SRCREC * +int newsource() /* allocate new source in our array */ { if (nsources == 0) @@ -53,11 +53,11 @@ newsource() /* allocate new source in our array */ source = (SRCREC *)realloc((char *)source, (unsigned)(nsources+1)*sizeof(SRCREC)); if (source == NULL) - return(NULL); + return(-1); source[nsources].sflags = 0; source[nsources].nhits = 1; source[nsources].ntests = 2; /* initial hit probability = 1/2 */ - return(&source[nsources++]); + return(nsources++); } @@ -180,6 +180,8 @@ OBJREC *op; ocent[i] += VERTEX(f,j)[i]; ocent[i] /= (double)f->nv; } + if (f->area == 0.) + return(0.); maxrad2 = 0.; for (j = 0; j < f->nv; j++) { d2 = dist2(VERTEX(f,j), ocent);