function fill_rect_ell(limcao,limcai)
global pot_press
%FIND BOUNDARY POINTS OF OUTER RECTANGLE
x1=limcao(1);
x2=limcao(1)+limcao(3);
y1=limcao(2);
y2=limcao(2)+limcao(4);
t=1;
for s=x1:x2
    rect(t,1)=s;
    rect(t,2)=y2;
    t=t+1;
end
for s=(y2-1):-1:y1
    rect(t,1)=x2;
    rect(t,2)=s;
    t=t+1;
end
for s=(x2-1):-1:x1
    rect(t,1)=s;
    rect(t,2)=y1;
    t=t+1;
end
for s=(y1+1):y2
    rect(t,1)=x1;
    rect(t,2)=s;
    t=t+1;
end
outer=rect;
clear rect

%%FIND BOUNDARY POINTS OF INNER ELLIPSE
x1=limcai(1);
x2=limcai(1)+limcai(3);
y1=limcai(2);
y2=limcai(2)+limcai(4);
w=limcai(3);
h=limcai(4);
%centre of inner ellipse
yc=(y1+y2)/2;
xc=(x1+x2)/2;
w=w/2;
h=h/2;
t=1;
for s=x1:.05:x2
    q=(sqrt(1-(((s-xc)/w)^2)))*h;
    a=yc+q;
    ell(t,1)=s;
    ell(t,2)=a;
    t=t+1;
end
for s=(x2-.05):-.05:x1
    q=(sqrt(1-(((s-xc)/w)^2)))*h;
    b=yc-q;
    ell(t,1)=s;
    ell(t,2)=b;
    t=t+1;
end
%inner=vertcat(ell,ptr);
inner=ell;
clear ell

polygon=vertcat(outer,inner);
col1=polygon(:,1);
col2=polygon(:,2);
if pot_press==1
    patch(col1,col2,'w','EdgeColor','w','EdgeAlpha',0)
else
    patch(col1,col2,'k','EdgeColor','k','EdgeAlpha',0)
end
return

