Code covered by the BSD License  

Highlights from
Circular region detection by a small moving circle

image thumbnail
from Circular region detection by a small moving circle by Ali Talib Oudah
Circular region detection by a small moving circle

test.m
rx=2;ry=2;shx=0;shy=0;
l=linspace(0,2*pi,100);
xv=rx*cos(l)'+shx;yv=ry*sin(l)'+shy;
xv=[xv;xv(1)];yv=[yv;yv(1)];
c1=xv+i*yv;
q=length(xv);
for it=q:-1:1
rx1=.5;ry1=.5;shx1=xv(it)*.02*it;shy1=yv(it)*.02*it;
l1=linspace(0,2*pi,20);
xv1=rx1*cos(l1)'+shx1;yv1=ry1*sin(l1)'+shy1;
xv1=[xv1;xv1(1)];yv1=[yv1;yv1(1)];
c2=xv1+i*yv1;
in = inpolygon(xv1,yv1,xv,yv);

plot(xv,yv,xv1(in),yv1(in),'r+',xv1(~in),yv1(~in),'bo')
axis([-6 6 -6 6])
axis square
pause(0)
end

Contact us at files@mathworks.com