MATLAB: Draw an arc between two points –> (x1,y1,z1) and (x2,y2,z2)

3d plotsarcdraw

Hi. I have several points on the sphere. I want to combine these points with arc. I can draw these points with lines but I can't draw arcs Please help

Best Answer

hi, you can try drawing a circle but restrict it into certain region,
I started a code, try to adjust/enhance it :
% Draw an arc between two points
p1=[-2 -2 -3];
p2=[10 15 20];
% Circle x²+y²+z²=Constant
%=> z=sqrt(Constant-x²-y²-);
Center=((p2+p1))./2;
xc=Center(1);
yc=Center(2);
zc=Center(3);
% Radius
R=norm((p2-p1))/2;
%Min=min(min(p1,p2));
%Max=max(max(p1,p2));
%x=linspace(Min,Max,20);
%y=linspace(Min,Max,20);
x=linspace(p1(1),p2(1),200);
y=linspace(p1(2),p2(2),200);
z=zc+sqrt((R^2)-((x-xc).^2)-((y-yc).^2));
figure, plot3(x,y,z), grid on, hold on
plot3(p1(1),p1(2),p1(3),'*','MarkerSize',10),
plot3(p2(1),p2(2),p2(3),'*','MarkerSize',10),
hold on, plot3(xc,yc,zc,'*','MarkerSize',10)