summaryrefslogtreecommitdiff
path: root/graphics/epix/doc/slices.xp
blob: c67dddf87622c82e0a49a36f2c4b61a966c057ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* -*-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();
}