intersection of 3 cercles (intersect problem)
Show older comments
I am trying to find the intersection between 3 cercles.
I started with intersection between each 2 cercles with "circcirc" function
then, to find the common point between [x1,y1] and [x2,y2] i used the intersect function but i got "Empty matrix: 1-by-0"
Can someone help me with this
%%Données pour configuation des transcepteurs
% Triangle equilateral inscrit dans un cercle de rayon R
R=50;
D=2*R;
a=D*sin(degtorad(60));
b=a; c=a;
h=sqrt(3)/2*a;
B=h*2/3*(cos(degtorad(30))-sin(degtorad(30))*i);
A=-h*2/3*(cos(degtorad(30))+sin(degtorad(30))*i);
C=i*2*h/3;
figure;
plot(A,'o');
grid on
hold on
plot(B,'o');
plot(C,'o');
ang=0:0.01:2*pi;
xp=R*cos(ang);
yp=R*sin(ang);
plot(xp,yp,'k');
axis('equal');
Tag=20+30i;
plot(Tag,'vk');
d1=sqrt((real(Tag)-real(A))^2+(imag(Tag)-imag(A))^2);
d2=sqrt((real(Tag)-real(B))^2+(imag(Tag)-imag(B))^2);
d3=sqrt((real(Tag)-real(C))^2+(imag(Tag)-imag(C))^2);
ang=0:0.01:2*pi;
xp1=d1*cos(ang);
yp1=d1*sin(ang);
C1=real(A)+xp1+i*(imag(A)+yp1);
plot(C1,'b');
ang=0:0.01:2*pi;
xp2=d2*cos(ang);
yp2=d2*sin(ang);
C2=real(B)+xp2+i*(imag(B)+yp2);
plot(C2,'g');
ang=0:0.01:2*pi;
xp3=d3*cos(ang);
yp3=d3*sin(ang);
C3=real(C)+xp3+i*(imag(C)+yp3);
plot(C3,'r');
[x1,y1]=circcirc(real(C),imag(C),d3,real(B),imag(B),d2);
[x2,y2]=circcirc(real(C),imag(C),d3,real(A),imag(A),d1);
TagExp= intersect(x1,x2)+i*intersect(y1,y2);
Answers (1)
Omar Elsayed
on 26 May 2017
Edited: Omar Elsayed
on 26 May 2017
This should work:
TagExp = x1(ismembertol(x1,x2)) + i*(y1(ismembertol(y1,y2)))
Categories
Find more on Vector Data in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!