summaryrefslogtreecommitdiff
path: root/systems/doc/metapost/source-tutorial/circles.mp
diff options
context:
space:
mode:
Diffstat (limited to 'systems/doc/metapost/source-tutorial/circles.mp')
-rw-r--r--systems/doc/metapost/source-tutorial/circles.mp22
1 files changed, 22 insertions, 0 deletions
diff --git a/systems/doc/metapost/source-tutorial/circles.mp b/systems/doc/metapost/source-tutorial/circles.mp
new file mode 100644
index 0000000000..ef7eadc765
--- /dev/null
+++ b/systems/doc/metapost/source-tutorial/circles.mp
@@ -0,0 +1,22 @@
+if scantokens(mpversion) > 1.005:
+ outputtemplate :=
+else:
+ filenametemplate
+fi
+"%j.mps";
+
+beginfig(0);
+ % Use 8 circles
+ N:=8;
+
+ % Compute the "correct" radius
+ r:=54*sind(180/N)/(1+sind(180/N));
+
+ % Define one of the cirlces
+ path p;
+ p:=fullcircle scaled (2*r);
+
+ % Draw all 8 circles
+ for n=0 upto N-1: draw p shifted (r/sind(180/N),0) rotated (360/N*n); endfor;
+endfig;
+end