"Roger Stafford" wrote in message <ku6p3r$gq7$1@newscl01ah.mathworks.com>...
> "Dasheek " <dasheekn@gmail.com> wrote in message <ku64jf$54h$1@newscl01ah.mathworks.com>...
> > Hi,
> >
> > I would like to create a curve of a certain radius with a start and finish point in 3D. After this I would like to discretize this curve and get points which lies on the curve. Please can someone assist me.
> >
> > Thanks a lot!
>          
> In three dimensions specifying the start point, the finish point, and the radius does not uniquely determine a circular arc, so I have selected a random orientation for it here. Also this leaves it possible to rotate through two possible angles, one less than pi and the other 2*pi minus the former. I have chosen the smaller of the two angles here.
>
> Let s and f be 3 x 1 column vectors of the start and finish point coordinates, respectively, and let r be the required radius. (Of course 2*r > norm(fs) must hold.)
>
> n = 25; % The number of desired points on the circular arc
> u = null((fs)'); % Choose a random vector orthogonal to fs
> u = u(:,1);
> v = (fs)/norm(fs);
> d = 1/2*norm(fs);
> c = (f+s)/2sqrt(r^2d^2)*u; % Center of circular arc
> a = asin(d/r); % Half the total angle that will be traversed
> t = linspace(a,a,n); % Discrete values of angles
> P = bsxfun(@plus,r*(u*cos(t)+v*sin(t)),c); % Points on the circle
>
> P will be a 3 x n array whose columns are points on the desired circular arc between s and f.
>
> Roger Stafford
Thank you a lot, I will try this out
