/* * xpsubs3.c * * subroutines for xprobe - fra(X) work */ #include #include /* * find 100* ratio of mean profile value at tip * to mean profile value elsewhere */ tipratio(p,m) struct object *p; int m; { int m1,m2,m3,hl; struct histogramdomain *h = (struct histogramdomain *)p->idom; hl = h->npoints; if (m < hl/2) { m1 = profmean(h,0,25); m2 = profmean(h,60,85); m3 = profmean(h,85,100); } else { m1 = profmean(h,75,100); m2 = profmean(h,15,40); m3 = profmean(h,0,15); } return (200*m3 / (m1+m2)); } profmean(h,k,l) struct histogramdomain *h; int k,l; { int *hv, hl, i, s; hl = h->npoints - 1; k = (hl * k + 50) / 100; l = (hl * l + 50) / 100; s = 0; hv = h->hv + k; for (i=k; i<=l; i++,hv++) s += *hv; return(s / (l-k+1)); }