summaryrefslogtreecommitdiff
path: root/graphics/epix/samples/torus.xp
blob: dbcfe31906947fd1e1a5dc145db6015f08d21e60 (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-*- */
/* torus.xp -- July 6, 2004 */
#include "epix.h"
using namespace ePiX;

const int N(8);

P F(double t1, double t2)
{
  return polar(2+Sin(t2), t1) + Cos(t2)*E_3;
}

domain R(P(0,0), P(1,1), mesh(4*N, 2*N), mesh(12*N, 6*N));

int main() 
{
  picture(P(-3,-3), P(3,3), "2x2in");

  begin();
  revolutions();
  camera.at(1.7,-1, 0.75);
  camera.range(8);

  rgb(0.2, 0.5, 0.7);

  plot(F, R.resize1(0,0.875));

  bold();
  rgb(0.5, 0.3, 0.9);
  plot(F, R.resize2(-0.375,0).resize1(0,0.125));

  red();
  dashed();
  plot(F, R.slice1(0));
  plot(F, R.slice2(0));

  end();
}