summaryrefslogtreecommitdiff
path: root/graphics/epix/doc/camera.xp
blob: 66f8fdb33488c4c4d92b15af07d12b446de1eadd (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* -*-ePiX-*- */
#include "epix.h"
using namespace ePiX;

const double ht(4);

const P target(0,0,0);
const P observer(0,-4,0);
const P dtarg(-0.5,0,1);
const double dx(0.375);

// location of label
const P obj_loc(1,0,0.25);

P F(P arg)
{
  double x(arg.x2());
  return (ht/(ht+x))*P(arg.x1(), 0, arg.x3());
}

P P1(0.75, -1,    -0.25);
P P2(1,    -1.25, -0.75);
P P3(0.5,  -1.5,  -0.5 );
P midpt((1.0/3)*(P1+P2+P3));

int main() {
  bounding_box(P(-3.5,-3.5),P(3.5,2.5));
  unitlength("0.375in");
  picture(P(7,6));

  begin();

  camera.at(P(1.5,-10,3.5));
  camera.range(10);

  font_size("footnotesize");
  right_angle(target, E_1, -E_2);

  line(target, target+2*dx*E_1);
  line(target, target+2*dx*E_3);

  //  grid(P(-3,0,-2), P(3,0,2), 6, 8);
  grid(P(-3,0,-2), P(3,0,2));

  masklabel(observer+E_1, P(2,0), "\\textbf{Sea}", r);
  masklabel(observer+E_3, P(0,2), "\\textbf{Sky}", t);
  masklabel(observer-E_2, P(-4,0), "\\textbf{Eye}", l);

  masklabel(observer, P(-2,0), "Viewpoint", l);
  dot(observer);

  masklabel(P(3,0,2), P(-6,-2), "Canvas", bl);

  line(observer, target);

  fill(Black(0.5));
  triangle(F(P1), F(P2), F(P3));

  line(P1, F(P1));
  line(P2, F(P2));
  line(P3, F(P3));

  line(observer, F(P1));
  line(observer, F(P2));
  line(observer, F(P3));

  fill(Black(0.1));
  triangle(P1, P2, P3);

  line(obj_loc, midpt);
  masklabel(obj_loc, P(0,0), "Object", t);

  line(P(2,0,-1), F(midpt));
  masklabel(P(2,0,-1), P(0,0), "Shadow", r);

  masklabel(target+dtarg, P(0,0), "Target", t);
  arrow(target+dtarg, target+0.1*dtarg, 0.5);
  dot(target);

  bold();
  arrow(observer, observer+E_1, 0.5);
  arrow(observer, observer-E_2, 0.5);
  arrow(observer, observer+E_3, 0.5);

  end();
}