# include <stdio.h>
# include <math.h>
# include "nanzan.h"

main()
{
  double x1, y1, x2, y2, xt, yt, alpha;
  double x1_old, y1_old, x2_old, y2_old;
  _XOpen;
  alpha = 3.141592 / 15;
  x1 = -250; y1 = 0; x2 = 250;  y2 = 0;
  _XDrawLine((int)(x1+250),(int)(y1+250),(int)(x2+250),(int)(y2+250));
  x1_old=x1; y1_old=y1; x2_old=x2; y2_old=y2;
  _XFlush;
  while(1) {
    usleep(1000);
    _XSetBlack;
    _XDrawLine((int)(x1_old+250),(int)(y1_old+250),(int)(x2_old+250),
	(int)(y2_old+250));
    xt = x1; yt = y1;
    x1 = xt * cos( alpha ) - yt * sin( alpha );
    y1 = xt * sin( alpha ) + yt * cos( alpha );
    xt = x2; yt = y2;
    x2 = xt * cos( alpha ) - yt * sin( alpha );
    y2 = xt * sin( alpha ) + yt * cos( alpha );
    _XSetYellow;
    _XDrawLine((int)(x1+250),(int)(y1+250),(int)(x2+250),(int)(y2+250));
    _XFlush;
    x1_old = x1; y1_old = y1; x2_old = x2; y2_old = y2;
  }
  _XClose;
}
