Creating an array and ruling out overlapping circles
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jonathan
le 23 Mar 2020
Réponse apportée : Walter Roberson
le 23 Mar 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 commentaires
Réponse acceptée
Walter Roberson
le 23 Mar 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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!