## plots interesting things from the logbook file

## when plotting something in two-dimensional space,
## it makes sense to force axes to be equal.
axis('equal') 
gset nokey
gset pointsize 2

## For the first plot I want to
## extract t=0,10,20,...
## points from logbook. I put them into two new matrices, one called
## subhistory, which looks just like logbook; and one called radius
## in which alternate rows will be left blank (zero). 
[imax,junk] = size(logbook);
P=17;          ## number of points I want
spacing = 10 ; ## this is the required spacing in time
rowspacing = ( logbook(2,1) - logbook(1,1) ) ; ## this is the current spacing
di = round(spacing/rowspacing);
if(di<1)
  di=1; ## catch silly results
endif
subhistory = zeros(P,junk);
radius     = zeros(2*P,junk);
j = 0 ; k = 0 ; 
i=1; 
targettime = 0; 

## Get the subhistory -- eg,
## extract every 10th row from the logbook
for j=1:P
  i = 1+(j-1)*di ;
  if (i > imax ) 
    break;
  endif
  subhistory(j,:) = logbook(i,:) ;
  k ++;
  k ++;
  radius(k,:) =     logbook(i,:) ;
endfor
## we have now got a P-row matrix called subhistory!

origin = [0,0] ;
figure(1)
				# figure(1)
gplot logbook u 2:3 w l 1 1 , radius u 2:3 w l  6 6 , subhistory u 2:3 w p 5 4, origin w p  3 5
				# figure(2)

figure(2)
gset autos xy
axis('normal')
gplot logbook u 1:2 w l, logbook u 1:3 w l

## ans = input"ready?";

