Creating an array and ruling out overlapping circles
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi Everyone!
I was undertaking a project where I am given various rectangles of various X and Y dimension. Within this rectangle there are numerous amounts of overlapping circles including some that fall outside the rectangle boundaries.
My goal is to find the percentage of the rectangle that is covered by the rectangle.
I'm not sure of the best way to do this and the functions involved? This is what I planned to do.
My thought process was to:
1) create an array of 0 with the rectangle's width and height.
2) If the circle intersects the rectangle (and the array), the values in the array are switched to a 1
3) Then calculate percentages of 1 over the inital amount of 0s
Does this idea make sense to everyone?
Which functions do I use here? (especially in step 1 and 2). (I'm not the best with matrices)
Any assistance would be great thanks!
댓글 수: 0
채택된 답변
Walter Roberson
2020년 3월 23일
The above link shows you ways to set values in a circle inside an array.
Once you had done that for all of the circles, 100*mean() of the array gives you the occupied percentage.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!