1 | // from http://math.uchicago.edu/~cstaats/Notes_and_papers_files/asymptote_tutorial.pdf
|
---|
2 | settings.outformat = "svg";
|
---|
3 | settings.prc = false;
|
---|
4 | settings.render=12;
|
---|
5 |
|
---|
6 | size(300.0pt,0);
|
---|
7 | import graph3;
|
---|
8 | currentprojection = perspective(30*dir(75,0));
|
---|
9 | real r1=5, r0=1;
|
---|
10 | int nu = 36, nv = 36;
|
---|
11 | path3 crossSection = Circle(r=r0, c=(r1,0,0), normal=Y, n= nu);
|
---|
12 | pen colorFunction(int u, real theta) {
|
---|
13 | real z = sin(u/nu * 2pi);
|
---|
14 | real t = (z + 1) / 2;
|
---|
15 | return t*red + (1-t)*lightblue;
|
---|
16 | }
|
---|
17 |
|
---|
18 | surface torus = surface(crossSection, c=(0,0,0), axis=Z, n=nv,
|
---|
19 | angle1=90, angle2=410, color=colorFunction);
|
---|
20 | draw(torus);
|
---|