필터 지우기
필터 지우기

How can I plot random circles that don't overlap

조회 수: 3 (최근 30일)
Charles Dorchester
Charles Dorchester 2020년 10월 30일
댓글: Charles Dorchester 2020년 11월 3일
I am trying to plot random circles until the critera: (area of all circles)/(area of domain) <= 0.4095 is fulfilled. I am struggling to figure out how to make the code plot only if the circles do not overlap.
I have three matrices of type double formatted like:
x = (250, 1); -- A randomized matrix of x-coordinates
y = (250,1); -- A randomized matrix of y-coordinates
r = (3,1); -- only three circle sizes to be plotted.
If possible, I'd like to run the code within a while loop which is calculating the (area of all circles)/(area of domain) criteria.
Plotting the first circle is easy, but I'd like to check this criteria against every circle so that they don't plot as overlapping. Does anyone have any suggestions?
Thank you.
  댓글 수: 3
Sindar
Sindar 2020년 10월 30일
First, you probably want (area of all circles)/(area of domain) greater/= 0.4095
Questions:
  • How different are the three radii?
  • Are you placing circles from the set of 250 one by one?
  • What happens if you get to the end of the set and don't fulfill the condition?
Hints
  • check out vecnorm and the examples from norm
  • check beforehand whether the total area of the 250 circles is sufficient
Now, could you code up everything you do understand, then we'll help with the last bits?
Charles Dorchester
Charles Dorchester 2020년 11월 3일
Thanks for the response Walter, I haven't had an opportunity to return to this project but that's super helpful to know there is already a host of responses to this. I will check it out ASAP.

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

답변 (1개)

Stephan
Stephan 2020년 10월 30일
편집: Stephan 2020년 10월 30일

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by