points lying inside a polygon and a circle

10 次查看(过去 30 天)
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) ?

采纳的回答

Matt J
Matt J 2017-1-30
编辑:Matt J 2019-4-25
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) )

更多回答(1 个)

Image Analyst
Image Analyst 2017-1-30
Did you try
count = 0;
if inpolygon(x,y,xCircle,yCircle) && inpolygon(x,y,xPoly,yPoly)
count = count + 1
end
where you call inpolygon twice, once passing in the circle coordinates and once passing in the polygon coordinates and then ANDing the two results together?
  6 个评论
KalMandy
KalMandy 2017-1-30
I have the radius and the coordinates of the center of the circle. what is given by xCircle,yCircle? Thanks for your response.
hanif hamden
hanif hamden 2019-4-25
If i put (x,y) in geographical coordinate and I want my radius is 10km. How should I do that?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Computational Geometry 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by