MATLAB: Points lying inside a polygon and a circle

inpolygon

How can I find the number of point lies inside both a circle and a polygon (the point should lie in the mutual/overlapping area in between the circle and the polygon) ?

Best Answer

If the circle is centered at (x0,y0), with radius R and the polygon has vertices xv,yv, you could do,
count = sum( inpolygon(x,y,xv,yv) & ((x-x0).^2+(y-y0).^2<=R^2) )