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!