summaryrefslogtreecommitdiff
path: root/graphics/epix/samples/bowl.xp
blob: fe3921b6db85f2159524731685d26a1e9c1098f4 (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
/* -*-ePiX-*- */
#include "epix.h"
using namespace ePiX;

P f(double u, double v)
{
  return u*P(Cos(v), Sin(v), u);
}

int main()
{
  picture(P(-2,-1),P(2,2), "6x4.5in");

  begin();

  backing(Black());

  white();
  label(P(0, ymax()), P(0,-2), "\\LARGE$z=x^2+y^2$", b);

  revolutions();
  camera.at(P(3,2,2.5));

  red();
  polar_grid(1, 8, 36);

  arrow(P(0,0,0), P(1.25,0,0));
  arrow(P(0,0,0), P(0,1.25,0));
  label(P(1.25,0,0), P(-2,-2), "$x$", bl);
  label(P(0,1.25,0), P(2,-1), "$y$", br);

  fill();
  rgb(1,0.8,0.2);
  domain R(P(0,0), P(1,1), mesh(12,180), mesh(12,180));

  scenery my(f, R);

  my.draw(1); // cull front-pointing facets

  red();
  arrow(P(0,0,0), P(0,0,1));

  pen(Blue(1.6), "0.5pt");
  fill(Blue(1.4));
  scenery my2(f, R);
  my2.draw(-1); // cull back-pointing facets

  nofill();
  bold(Green());
  base(Green(0.6), "1.5pt");
  plot(f, R.slice1(1));

  pst_format();
  end();
}