summaryrefslogtreecommitdiff
path: root/info/drawing-with-metapost/src/closed-polygon-chain.mp
diff options
context:
space:
mode:
Diffstat (limited to 'info/drawing-with-metapost/src/closed-polygon-chain.mp')
-rw-r--r--info/drawing-with-metapost/src/closed-polygon-chain.mp18
1 files changed, 18 insertions, 0 deletions
diff --git a/info/drawing-with-metapost/src/closed-polygon-chain.mp b/info/drawing-with-metapost/src/closed-polygon-chain.mp
new file mode 100644
index 0000000000..14f9b28738
--- /dev/null
+++ b/info/drawing-with-metapost/src/closed-polygon-chain.mp
@@ -0,0 +1,18 @@
+\documentclass[border=5mm]{standalone}
+\usepackage{luamplib}
+\begin{document}
+\mplibtextextlabel{enable}
+\begin{mplibcode}
+input archimedean-tools
+beginfig(1);
+ path P[]; P3 = for i=0 upto 2: 6 up rotated 120i -- endfor cycle;
+ fill P3 withcolor 3/4 red; draw P3;
+ for n = 4 upto 23:
+ numeric m; m = floor(n / 2);
+ P[n] = poly n of subpath (m, m-1) of P[n-1];
+ fill P[n] withcolor (n/32)[3/4 if odd n: red else: blue fi, white];
+ draw P[n]; label(decimal n, median(P[n]));
+ endfor
+endfig;
+\end{mplibcode}
+\end{document}