% intersections with a circle clear clc x = [] y = [] colormap('default') disp('check for 0 intercepts') [px py] = intercept( 1, 0, -2 ); x = [x px]; y = [y py]; disp('check for 1 intercept') [px py] = intercept( 1, 0, 1); x = [x px]; y = [y py]; disp('check for 2 intercepts') [px py] = intercept( 1, -1, 0); x = [x px]; y = [y py]; [px py] = intercept( 1, -.5, 0); x = [x px]; y = [y py]; [px py] = intercept( 1, 0, 0); x = [x px]; y = [y py]; [px py] = intercept( 1, .5, 0); x = [x px]; y = [y py]; [px py] = intercept( 1, 1, 0); x = [x px]; y = [y py]; [px py] = intercept( 1, -1, -.5); x = [x px]; y = [y py]; [px py] = intercept( 1, -.5, -.5); x = [x px]; y = [y py]; [px py] = intercept( 1, 0, -.5); x = [x px]; y = [y py]; [px py] = intercept( 1, .5, -.5); x = [x px]; y = [y py]; [px py] = intercept( 1, 1, -.5); x = [x px]; y = [y py]; [px py] = intercept( 1, -1, 0.5); x = [x px]; y = [y py]; [px py] = intercept( 1, -.5, 0.5); x = [x px]; y = [y py]; [px py] = intercept( 1, 0, 0.5); x = [x px]; y = [y py]; [px py] = intercept( 1, .5, 0.5); x = [x px]; y = [y py]; [px py] = intercept( 1, 1, 0.5); x = [x px]; y = [y py]; [px py] = intercept( 1, -1, 1); x = [x px]; y = [y py]; [px py] = intercept( 1, -.5, 1); x = [x px]; y = [y py]; [px py] = intercept( 1, 0, 1); x = [x px]; y = [y py]; [px py] = intercept( 1, .5, 1); x = [x px]; y = [y py]; [px py] = intercept( 1, 1, 1); x = [x px]; y = [y py]; [px py] = intercept( 1, -1, -1); x = [x px]; y = [y py]; [px py] = intercept( 1, -.5, -1); x = [x px]; y = [y py]; [px py] = intercept( 1, 0, -1); x = [x px]; y = [y py]; [px py] = intercept( 1, .5, -1); x = [x px]; y = [y py]; [px py] = intercept( 1, 1, -1); x = [x px]; y = [y py]; plot(x,y,'rx') axis equal pause hold on th = 0:.01:2*pi; plot(cos(th), sin(th))