I have two points on a unit sphere. I also have their coordinates.
theta=linspace(0,2*pi,20); phi=linspace(0,pi,20); [theta,phi]=meshgrid(theta,phi); rho=1; x=rho*sin(phi).*cos(theta); y=rho*sin(phi).*sin(theta); z=rho*cos(phi); mesh(x,y,z) xyz=randn(3,2); xyz=bsxfun(@rdivide,xyz,sqrt(sum(xyz.^2,1))); a=xyz(:,1)'; b=xyz(:,2)'; plot3([a(1) b(1)],[a(2) b(2)],[a(3) b(3)],'r'); % Connect ab
Now I want to move both the points a and b towards each other on this unit circle by a fixed parameter( i.e. 5% of distance between them) everytime. I dont know how to do this. Please help using the code I have written as will help me understand better.