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

void my_grid(const P& loc, int N1, int N2, std::string lab)
{
  if (0 < N1)
    {
      const double dx(1.0/N1);
      for (int i=-N1; i<= N1; ++i)
	line(loc+P(i*dx,0), loc+P(i*dx,2));
    }

  if (0 < N2)
    {
      const double dy(1.0/N2);
      for (int i=0; i<= N2; ++i)
	line(loc+P(-1,2*i*dy), loc+P(1,2*i*dy));
    }

  label(loc, P(0,-4), "\\code{"+lab+"}", b);
}

int main() 
{
  bounding_box(P(0,0),P(7,2));
  unitlength("1in");
  picture(5,0.75);

  begin();

  bold();

  my_grid(P(1,0), 4, 7, "R");
  my_grid(P(3.5,0), 4, 0, "R.slices1()");
  my_grid(P(6,0), 0, 3, "R.slices2(3)");

  end();
}
