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

void Map(const P& tail, const P& head, double dt = 0.1)
{
  P dir(head - tail);
  arrow(tail + dt*dir, head - dt*dir);
}

int main()
{
  picture(P(0, 1), P(2, 2), "2 x 1.5in");

  begin();
  arrow_width(5);
  arrow_ratio(2);
  arrow_inset(0.75);

  P Pa(0, 2), Pb(2, 2), Pc(2, 1), Pd(0, 1);

  dot(Pa, P(-2, 2), "$x$", tl);
  dot(Pb, P( 2, 2), "$y$", tr);
  dot(Pc, P( 2,-4), "$w$", br);
  dot(Pd, P(-2,-4), "$z$", bl);

  bold();
  Map(Pa, Pb);
  Map(Pa, Pd);

  Map(Pb, Pc);
  Map(Pd, Pc);

  label(0.5*(Pa + Pb), P(0, 2), "$\\mathrm{P}$", t);
  label(0.5*(Pa + Pd), P(-4, 0), "$\\mathrm{S}$", l);
  label(0.5*(Pb + Pc), P( 4, 0), "$\\mathrm{S}$", r);
  label(0.5*(Pd + Pc), P(0,-4), "$\\mathrm{Q}$", b);

  tikz_format();
  end();
}
