Merging overlapping circles and remove the union part
7 ビュー (過去 30 日間)
古いコメントを表示
HAINGKHARRAN GUNASEKARAN
2021 年 6 月 12 日
コメント済み: Star Strider
2021 年 6 月 12 日
Hello, I've plot 2 circles on different positions (different centres) on a picture. The 2 circles overlap with one another and I wish to merge the overlapping part as shown in the attachment (the union part is removed). Is it possible to do this on MATLAB? Is there any specific coding for this? Thank you.
0 件のコメント
採用された回答
Star Strider
2021 年 6 月 12 日
One approach —
t = linspace(0,2*pi,500); % Allow Adequate Resolution For Best Results
r = 1;
x = @(t) r*cos(t);
y = @(t) r*sin(t);
xc1 = -0.7;
xc2 = +0.7;
circ1 = [x(t)+xc1; y(t)]; % First Circle
circ2 = [x(pi-t)+xc2; y(pi-t)]; % 'Phase' Second Circle So 'inpolygon' Works Correctly
incirc1 = inpolygon(circ1(1,:),circ1(2,:), circ2(1,:),circ2(2,:)); % Detect Intersections
incirc2 = inpolygon(circ2(1,:),circ2(2,:), circ1(1,:),circ1(2,:)); % Detect Intersections
figure
plot(circ1(1,~incirc1),circ1(2,~incirc1),'-k', circ2(1,~incirc2),circ2(2,~incirc2),'-k')
axis('equal')
axis([-2 2 -1.5 1.5])
Interesting problem!
.
2 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
