summaryrefslogtreecommitdiff
path: root/graphics/asymptote/examples/RiemannSphere.asy
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/asymptote/examples/RiemannSphere.asy')
-rw-r--r--graphics/asymptote/examples/RiemannSphere.asy47
1 files changed, 47 insertions, 0 deletions
diff --git a/graphics/asymptote/examples/RiemannSphere.asy b/graphics/asymptote/examples/RiemannSphere.asy
new file mode 100644
index 0000000000..ec1ab7586a
--- /dev/null
+++ b/graphics/asymptote/examples/RiemannSphere.asy
@@ -0,0 +1,47 @@
+import graph3;
+import solids;
+
+currentlight=White;
+defaultrender.merge=true;
+
+size(10cm,0);
+
+pair k=(1,0.2);
+real r=abs(k);
+real theta=angle(k);
+
+real x(real t) { return r^t*cos(t*theta); }
+real y(real t) { return r^t*sin(t*theta); }
+real z(real t) { return 0; }
+
+real u(real t) { return x(t)/(x(t)^2+y(t)^2+1); }
+real v(real t) { return y(t)/(x(t)^2+y(t)^2+1); }
+real w(real t) { return (x(t)^2+y(t)^2)/(x(t)^2+y(t)^2+1); }
+
+real nb=3;
+for (int i=0; i<12; ++i) draw((0,0,0)--nb*(Cos(i*30),Sin(i*30),0),yellow);
+for (int i=0; i<=nb; ++i) draw(circle((0,0,0),i),lightgreen+white);
+
+
+path3 p=graph(x,y,z,-200,40,operator ..);
+path3 q=graph(u,v,w,-200,40,operator ..);
+
+revolution sph=sphere((0,0,0.5),0.5);
+draw(surface(sph),green+white+opacity(0.5));
+
+draw(p,1bp+heavyred);
+draw(q,1bp+heavyblue);
+
+triple
+ A=(0,0,1),
+ B=(u(40),v(40),w(40)),
+ C=(x(40),y(40),z(40));
+
+path3 L=A--C;
+draw(L,1bp+black);
+
+pen p=fontsize(8pt);
+
+dot("$(0,0,1)$",A,N,p);
+dot("$(u,v,w)$",B,E,p);
+dot("$(x,y,0)$",C,E,p);