given three points , how to find a circular arc.
there is 3 points.
p1(x1,y1) p2(x2,y2) p3(x3,y3)
I have to find arc of the 3 point connection.
this is mfile.
=====================================
function case1(x1,y1,x2,y2,x3,y3)
x21 = x2x1; y21 = y2y1;
x31 = x3x1; y31 = y3y1;
h21 = x21^2+y21^2; h31 = x31^2+y31^2;
d = 2*(x21*y31x31*y21);
a = x1+(h21*y31h31*y21)/d;
b = y1(h21*x31h31*x21)/d;
r = sqrt(h21*h31*((x3x2)^2+(y3y2)^2))/abs(d);
a1=atan((y1b)/(x1a))
a2=atan((y3b)/(x3a))
th=0;
if x1<a
a2 = a2 2*pi;
end
r=sqrt((x1a)^2+(y1b)^2)
th = linspace( a1 , a2 , 1000);
D = (x2x1)*(y2y1);
if D > 0
Px = a  r*cos(th);
Py = b  r*sin(th);
elseif D < 0
Px = a + r*cos(th);
Py = b + r*sin(th);
elseif D==0
if (x3x1)*(y3y1)>0
Px = a  r*cos(th);
Py = b  r*sin(th);
else
Px = a + r*cos(th);
Py = b + r*sin(th);
end
end
plot(Px,Py), grid on
=====================================
I have failed this problem TT in matlab.
For example, in this case (x1=x2) i type case1(3,4,3,6,6,5) In matlab<<<
. I cant obtain correct graph in matlab.
thanks for your effort
