/* -*-ePiX-*- */
#include "epix.h"
using namespace ePiX;

const double mult(4.5);

const double tau(0.4);
double CSH(cosh(tau)), SNH(sinh(tau));

P boost(const P& arg)
{
  double x(arg.x1()), y(arg.x2());
  return P(CSH*x + SNH*y, CSH*y + SNH*x);
}

void my_grid(const P& arg, const std::string& msg1, const std::string& msg2)
{
  P arg2(arg.x2(), arg.x1());
  for (int i=0; i < 5; ++i)
    {
      line(i*arg,  i*arg  + mult*arg2);
      line(i*arg2, i*arg2 + mult*arg);
    }

  label(P(0,0), P(0,-4),   "$O$",  b);
  label(mult* arg, P(-2,-4), msg1, br);
  label(mult*arg2, P(-4),   msg2, tl);
}

int main()
{
  picture(P(0,0), P(2.5,1.5), "5 x 3in");

  begin();
  label(P(0.5, -0.125), P(0,-4), "\\textsc{Fig.~5.}", b);
  label(P(1.625, -0.125), P(0,-4), "\\textsc{Fig.~6.}", b);

  screen scr1(P(0,0), P(5, 5)), scr2(P(0,0), P(7,7));

  bold();
  font_size("footnotesize");
  activate(scr1);
  my_grid(P(1,0), "$X$", "$T$");
  inset(P(0,0), P(1,1));
  deactivate(scr1);

  activate(scr2);
  my_grid(boost(P(1,0)), "$X_1$", "$T_1$");
  inset(P(1.1,0), P(2.5,1.4));
  deactivate(scr2);

  tikz_format();
  end();
}
