Need to create filled circles with a solid border that iterate over each other.

2 ビュー (過去 30 日間)
Elijah Jones
Elijah Jones 2023 年 11 月 14 日
回答済み: Image Analyst 2023 年 11 月 15 日
I am designing code that is ment to simulate impacts on a surface. it creates circles that land on top of each other. I would like each craterr to be a filled crater with a hard border such as a a black circle with a blue border so that it covers previous crater borders.

回答 (2 件)

Voss
Voss 2023 年 11 月 14 日
xy = [0 0; 1 1; 2.5 0.5; -2 -1] % crater centers
xy = 4×2
0 0 1.0000 1.0000 2.5000 0.5000 -2.0000 -1.0000
r = [3; 2; 1; 2] % crater radii
r = 4×1
3 2 1 2
% use patch to create the circles:
figure
axis equal
ax = gca();
th = linspace(0,2*pi,100);
for ii = 1:size(xy,1)
patch(ax,xy(ii,1)+r(ii)*cos(th),xy(ii,2)+r(ii)*sin(th),'k','EdgeColor','b');
end

Image Analyst
Image Analyst 2023 年 11 月 15 日
If you want it as a digital image, see my attached demo. Feel free to adapt it to your needs.

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by