Borrar filtros
Borrar filtros

Merging overlapping circles and remove the union part

4 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

Star Strider
Star Strider el 12 de Jun. de 2021
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 comentarios
HAINGKHARRAN GUNASEKARAN
HAINGKHARRAN GUNASEKARAN el 12 de Jun. de 2021
Thank you so much,I'll go through it.
Star Strider
Star Strider el 12 de Jun. de 2021
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by