function [data,P,r]=ginit(L)
% usage: [data,P,r]=ginit(L)
% sets up square [-L,L]x[L,L]
% and returns three point coordinates in the rows of data
% as well as a point in P and a radius r

%clear all variables
clear data;
%set up a new figure and keep all plots
figure;
hold on;
%put axis and make square plot
axis([-L,L,-L,L]);
axis square;
%get three points
title('Geben Sie drei Punkte ein');
for i=1:3 
  P=ginput(1);
  plot(P(1),P(2),'b*');
  data(i,:)=P;
end;
%now coordinates are stored in the rows of variable data
% next: get initial data
title('Markieren Sie den Startmittelpunkt');
P=ginput(1);
plot(P(1),P(2),'r*');
title('Markieren Sie den Startradius'); 
Q=ginput(1);
r=sqrt(sum((P-Q).^2));
%plot as red circle
circle(P,r,'','r');
%and clear title
title('');
