the attached code can be used to hatch the overlap of three circles with three intersection points
hatch the overlap region of 3 circles
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
sahar
el 9 de Jun. de 2017
Respondida: sahar
el 10 de Jun. de 2017
I like to know how to hatch the overlap of 3 circles with 3 intersection points?
0 comentarios
Respuesta aceptada
Más respuestas (1)
KSSV
el 9 de Jun. de 2017
You could have applied this logic https://in.mathworks.com/matlabcentral/answers/343595-hatch-overlap-region-of-two-circles to three circles also.
N1 = 100 ; N2 = 50 ;
th = linspace(0,2*pi,N1)' ;
r1 = 1. ; r2 = 1. ; r3 = 1. ;% radii of circles
c1 = [0 0] ; % center of first cirlce
c2 = [1.5 0] ; % center of second circle
c3 = [0.75 0.5] ;
a1 = repmat(c1,[N1 1])+[r1*cos(th) r1*sin(th)] ;
a2 = repmat(c2,[N1 1])+[r2*cos(th) r2*sin(th)] ;
a3 = repmat(c3,[N1 1])+[r3*cos(th) r3*sin(th)] ;
%
plot(a1(:,1),a1(:,2),'r') ;
hold on
plot(a2(:,1),a2(:,2),'r') ;
plot(a3(:,1),a3(:,2),'r') ;
axis equal
%%Get points of 1 circle lying in 2 circle
in12 = inpolygon(a1(:,1),a1(:,2),a2(:,1),a2(:,2)) ;
P1 = a1(in12,:) ;
% Get points of second circle lying in first circle
in21 = inpolygon(a2(:,1),a2(:,2),a1(:,1),a1(:,2)) ;
P2 = a2(in21,:) ;
% form the oval / intersection boundary
R = [P1 ;P2] ;
idx = convhull(R(:,1),R(:,2)) ;
patch(R(idx,1),R(idx,2),'r')
%%Get points of 1 circle lying in 3 circle
in13 = inpolygon(a1(:,1),a1(:,2),a3(:,1),a3(:,2)) ;
P1 = a1(in13,:) ;
% Get points of 3 circle lying in 1 circle
in31 = inpolygon(a3(:,1),a3(:,2),a1(:,1),a1(:,2)) ;
P2 = a3(in31,:) ;
% form the oval / intersection boundary
R = [P1 ;P2] ;
idx = convhull(R(:,1),R(:,2)) ;
patch(R(idx,1),R(idx,2),'r')
%%Get points of 2 circle lying in 3 circle
in23 = inpolygon(a2(:,1),a2(:,2),a3(:,1),a3(:,2)) ;
P1 = a2(in23,:) ;
% Get points of 3 circle lying in 2 circle
in32 = inpolygon(a3(:,1),a3(:,2),a2(:,1),a2(:,2)) ;
P2 = a3(in32,:) ;
% form the oval / intersection boundary
R = [P1 ;P2] ;
idx = convhull(R(:,1),R(:,2)) ;
patch(R(idx,1),R(idx,2),'r')
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!