summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/asymptote/examples/triangulate.asy
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/asymptote/examples/triangulate.asy')
-rw-r--r--Master/texmf-dist/doc/asymptote/examples/triangulate.asy19
1 files changed, 19 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/asymptote/examples/triangulate.asy b/Master/texmf-dist/doc/asymptote/examples/triangulate.asy
new file mode 100644
index 00000000000..56ad347b53d
--- /dev/null
+++ b/Master/texmf-dist/doc/asymptote/examples/triangulate.asy
@@ -0,0 +1,19 @@
+size(200);
+int np=100;
+pair[] points;
+
+real r() {return 1.2*(rand()/randMax*2-1);}
+
+for(int i=0; i < np; ++i)
+ points.push((r(),r()));
+
+int[][] trn=triangulate(points);
+
+for(int i=0; i < trn.length; ++i) {
+ draw(points[trn[i][0]]--points[trn[i][1]]);
+ draw(points[trn[i][1]]--points[trn[i][2]]);
+ draw(points[trn[i][2]]--points[trn[i][0]]);
+}
+
+for(int i=0; i < np; ++i)
+ dot(points[i],red);