"satish sahu" <satishs@iitk.ac.in> wrote in message <jks456$jqq$1@newscl01ah.mathworks.com>...
> i have three point center point(p0), begin point(p1) and end point(p2).
> p0=(x0,y0,z0)
> p1=(x1,y1,z1)
> p2=(x2,y2,z2)
> want to plot arc on 3d,
>
> case(1)=(x0,y0,z0,x1,y1,z1,x2,y2,z2) all are known
>
> case(2)=(x0,y0,z0,x1,y1,z1,z2) are known (x2 and y2 are unknown)
>
> plz reply
         
I assume that by "center point(p0)" you mean that p0 is to be at the center of a circular arc between p1 and p2. In your case(2) the possible location of p2 is any point on the surface of a sphere with center at p0 and with norm(p1p0) as radius. That means that knowing only z2 is not sufficient to uniquely determine p2  it could be anywhere in a ring at height z2. Case(2) is not a wellformed problem.
As for case(1) the following code should draw the arc. It works even if p0 is not at the midpoint of the arc.
% The three points as row vectors
p0 = randn(1,3); p2 = randn(1,3); p1 = randn(1,3); % You choose p0,p1,p2
% The engine
t = p2p0; u = p1p0; v = p1p2;
w = cross(t,u);
t2 = sum(t.^2); u2 = sum(u.^2); w2 = sum(w.^2);
c = p0+(t2*sum(u.*v)*uu2*sum(t.*v)*t)/(2*w2); % < The center
r = 1/2*sqrt(t2*u2*sum(v.^2)/w2); % < The radius
a = p1c; a = a/norm(a);
b = cross(w,a); b = b/norm(b);
n = 100;
ang = linspace(0,mod(atan2(dot(p2c,b),dot(p2c,a)),2*pi),n).';
T = bsxfun(@plus,r*(cos(ang)*a+sin(ang)*b),c);
% The plot of the circular arc from p1 to p2
plot3(T(:,1),T(:,2),T(:,3))
You can add the points p0, p1, and p2 to this plot to verify that they are on the arc.
Roger Stafford
