
// line is a circle with that cross the unit circle perpendicularly

function limitCircle()
	t=0:0.01:2*%pi;
	plot(cos(t),sin(t),'r:');
endfunction

function y = circleY(x)
	y = sqrt(1 - x^2);
endfunction

function c = centerX(x)
	c = 1/x;
endfunction

function r = radiusX(x)
	c = centerX(x)
	r = sqrt((c-x)^2 + circleY(x)^2);
endfunction

function plotCircle(x)
	y = circleY(x);
	c = centerX(x);
	r = radiusX(x);
	ref = atan(y/(c - x));
	theta1 = %pi - ref;
	theta2 = %pi + ref
	deltat = (theta2-theta1)/100;
	t = theta1:deltat:theta2;
	plot(r*cos(t)+c,r*sin(t),'k-');
	plot([x,x],[-y,y],'ko');
endfunction

clf
limitCircle()
plotCircle(0.95);
plotCircle(0.9);
plotCircle(0.8);
plotCircle(0.6);
plotCircle(0.4);
plotCircle(0.2);

a = gca();
a.isoview="on";
a.box="off";
a.axes_visible=["off","off","off"];
//a.data_bounds=[-1.1, -1.1; 1.1, 1.1];

//clf
//limitCircle()
