clear all close all % u^2 + v^2 = 1 % major radius a % minor radius b % coordinates (bu, av) u=[0:0.01:1]; v=sqrt(1-u.^2); a=5; b=2; x=a*v; y=b*u; % how much to offset % presumably the radius of the tool T=0.33; hold on axis([0 6 0 6]) dt=0.05 t=[0:dt:pi/2+dt]; px=a*cos(t); py=b*sin(t); plot(px,py,'m') nox=b*cos(t); noy=a*sin(t); l=sqrt(nox.^2 + noy.^2); nox=(nox./l)*T; noy=(noy./l)*T; plot(px+nox,py+noy) k=3.4; plot([k k],[0 6],'k--') tk=fzero(@oe,[0, pi/2]) l=sqrt( (b*cos(tk))^2 + (a*sin(tk))^2 ) ox=(a+T*b/l)*cos(tk) oy=(b+T*a/l)*sin(tk) plot(ox,oy,'ko') px=a*cos(tk); py=b*sin(tk); plot(px,py,'*') h=line([0 px],[0 py]) set(h,'Color','red') h=line([px ox],[py oy]) set(h,'Color','green') hold off