summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/asymptote/examples/Gouraudcontour.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/asymptote/examples/Gouraudcontour.asy')
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/Gouraudcontour.asy31
1 files changed, 31 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/asymptote/examples/Gouraudcontour.asy b/Master/texmf-dist/doc/asymptote/examples/Gouraudcontour.asy
new file mode 100644
index 00000000000..1cf788869a2
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/Gouraudcontour.asy
@@ -0,0 +1,31 @@
+import graph;
+import palette;
+import contour;
+
+size(200);
+
+int n=100;
+
+real[] x=new real[n];
+real[] y=new real[n];
+real[] f=new real[n];
+
+real F(real a, real b) {return a^2+b^2;}
+
+real r() {return 1.1*(rand()/randMax*2-1);}
+
+for(int i=0; i < n; ++i) {
+ x[i]=r();
+ y[i]=r();
+ f[i]=F(x[i],y[i]);
+}
+
+pen Tickpen=black;
+pen tickpen=gray+0.5*linewidth(currentpen);
+pen[] Palette=BWRainbow();
+
+bounds range=image(x,y,f,Range(0,2),Palette);
+draw(contour(pairs(x,y),f,new real[]{0.25,0.5,1},operator ..));
+
+palette("$f(x,y)$",range,point(NW)+(0,0.5),point(NE)+(0,0.8),Top,Palette,
+ PaletteTicks(Tickpen,tickpen));