function [xc,yc]=findmid(x,y)
global shape
[disc,page]=size(shape);
flag=0;
for i=1:page
    temp=shape(i).elem;
    [mtemp,ntemp]=size(temp);
    for j=1:mtemp
        if (temp(j,1)==x)&&(temp(j,2)==y)
            number=i;
            flag=1;
            break
        end
    end
    if flag==1
        break
    end
end

temp=shape(number).elem;
x1=min(temp(:,1));
y1=min(temp(:,2));
y2=max(temp(:,2));
xc=x1+1;
yc=(y1+y2)/2;
return