int place(tk,bk,p,k) Gpoint *p; int *tk,*bk,k; { double m,v=p[k].x,interp; int i=*tk,j=*bk; /* * Get new values for tk and bk */ while (top[i].x <= v && i < topn-1) i++; while (bottom[j].x <= v && j < bottomn-1) j++; *tk = (i != 0)?i-1:0; *bk = (j != 0)?j-1:0; i = *tk; j = *bk; /* * Test for above. */ m = (top[i+1].y - top[i].y)/(top[i+1].x - top[i].x); interp = m*(v - top[i+1].x) + top[i+1].y; if (interp < p[k].y) return (1); /* Point is above top. */ /* * Test for below. */ m = (bottom[j+1].y - bottom[j].y)/(bottom[j+1].x - bottom[j].x); interp = m*(v - bottom[j+1].x) + bottom[j+1].y; if (interp > p[k].y) return (-1); /* Point is below bottom. */ return (0); /* Point is inside mask */ }