% arc.m
%        trace d un arc de cercle passant par A et B, 
%        lieu des points tq angle (AM , BM) = 2*pi / 3 
% fd, 05 novembre 2006, 5 mars 2025
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  entrees         xa ya coordonnees de A 
%                  xb yb coordonnees de B 
%  sortie          plot...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  function n=arc(xa,ya,xb,yb) ; 
abx = xb - xa ; aby = yb - ya ; 
aa = sqrt ( abx**2 + aby**2 ) ; 
nx = -aby ; ny = abx ; 
rr=aa/sqrt(3) ; 
xc = xa + .5*abx - 1 / (2*sqrt(3))*nx ; 
yc = ya + .5*aby - 1 / (2*sqrt(3))*ny ; 
plot ( xc , yc , 'or;;') 
cbx = xb - xc ; cby = yb - yc ; 
n=200 ; cercle=zeros(2,n+1) ; 
dth = 2*pi / (3*n) ; theta = 0 ; 
for j=1:n+1; 
cercle(1,j:j) = xc + (cos(theta)*cbx - sin(theta)*cby) ; 
cercle(2,j:j) = yc + (cos(theta)*cby + sin(theta)*cbx) ; 
theta = theta + dth ; end ; 
plot ( cercle(1:1,:) , cercle(2:2,:) , 'k;;') 
 
