Creating an array and ruling out overlapping circles
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jonathan
am 23 Mär. 2020
Beantwortet: Walter Roberson
am 23 Mär. 2020
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 23 Mär. 2020
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!