function c = SphereIntercept(u,v,SphereRadius)
%Compute the coordinates of the intercept of a sphere surface and the line conecting to points
%intercept point is c, k is vector connecting points, n is distance along k that c is located

%Check if sphere is between vectors u and v
if (insphere(u,SphereRadius) & ~insphere(v,SphereRadius))
   %OK to copute intercept
   k = (v-u);
   nk = norm(k);
   nu = norm(u);
   duk = dot(u,k);
   n= (-2*duk + sqrt((2*duk)^2-4*nk*nk*(nu*nu-SphereRadius^2)))/(2*nk*nk);
   c = u+n*k;
else
   c = [0;0;0];
end
