Find all the grid points that are inside of the circle

조회 수: 15 (최근 30일)
Marina Markaki
Marina Markaki 2021년 4월 22일
댓글: Star Strider 2021년 4월 27일
I have my radius being between 1 and 10 and my angle from 0 to 2pi. I defined an uniform rectangular grid with 10 points (10 by 10) and I want to find how many points fall into the circle. Thanks a lot.

채택된 답변

Star Strider
Star Strider 2021년 4월 22일
Use the inpolygon function.
  댓글 수: 2
Marina Markaki
Marina Markaki 2021년 4월 27일
But I want the points located inside or on edge of a cricle not a polygonal region. Is this going to work?
Star Strider
Star Strider 2021년 4월 27일
The inpolygon function can output the points in or on the polygon.
A polygon does not havve any defined shape, other than being a closed boundary, so a circle is a polygon.
It will work. (Since this appears to me to be homework, I did not post the code I wrote to check it to be certain that it does.)
.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Elementary Polygons에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by