summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-08-02 21:30:22 +0000
committerKarl Berry <karl@freefriends.org>2015-08-02 21:30:22 +0000
commitc4cbbdc6c246816defebc2afa9fd9b82b42118e3 (patch)
tree478c48d21c8f6bd82b7520f146168e9db82bc56c /Master
parent008ccd78c7a2d5abf3e17cb872cf1536f6192ecb (diff)
shapes (2aug15)
git-svn-id: svn://tug.org/texlive/trunk@38024 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/metapost/shapes/CHANGES6
-rw-r--r--Master/texmf-dist/doc/metapost/shapes/README3
-rw-r--r--Master/texmf-dist/doc/metapost/shapes/shapes.pdfbin174341 -> 176460 bytes
-rw-r--r--Master/texmf-dist/metapost/shapes/shapes.mp38
-rw-r--r--Master/texmf-dist/source/metapost/shapes/shapes.dtx69
5 files changed, 113 insertions, 3 deletions
diff --git a/Master/texmf-dist/doc/metapost/shapes/CHANGES b/Master/texmf-dist/doc/metapost/shapes/CHANGES
new file mode 100644
index 00000000000..90712739238
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/shapes/CHANGES
@@ -0,0 +1,6 @@
+v1.1, released on 1 August 2015: updated; now allows ticks
+around the circle of the modular shapes at arbitrary
+intervals. The ticks can be styled by length and pen.
+
+v1.0, released on 18 July 2015: initial release. All basic
+functionality implemented.
diff --git a/Master/texmf-dist/doc/metapost/shapes/README b/Master/texmf-dist/doc/metapost/shapes/README
index e85c1e69e22..0310f8914c1 100644
--- a/Master/texmf-dist/doc/metapost/shapes/README
+++ b/Master/texmf-dist/doc/metapost/shapes/README
@@ -23,6 +23,3 @@ The shapes macros for Metapost provide regular polygons,
their corresponding reentrant stars, and images
demonstrating fractions. These macros are quite
configurable.
-
-v1.0, released on 18 July 2015: initial release. All basic
-functionality implemented.
diff --git a/Master/texmf-dist/doc/metapost/shapes/shapes.pdf b/Master/texmf-dist/doc/metapost/shapes/shapes.pdf
index adfac70ceaa..69510315a68 100644
--- a/Master/texmf-dist/doc/metapost/shapes/shapes.pdf
+++ b/Master/texmf-dist/doc/metapost/shapes/shapes.pdf
Binary files differ
diff --git a/Master/texmf-dist/metapost/shapes/shapes.mp b/Master/texmf-dist/metapost/shapes/shapes.mp
index 33b20ddd3d7..e868003b030 100644
--- a/Master/texmf-dist/metapost/shapes/shapes.mp
+++ b/Master/texmf-dist/metapost/shapes/shapes.mp
@@ -73,6 +73,10 @@ enddef;
boolean modcircle; modcircle := true;
pen modcirclepen; modcirclepen := pencircle scaled 1;
pen modshapepen; modshapepen := pencircle scaled 1;
+boolean modticks; modticks := false;
+numeric nummodticks; nummodticks := 12;
+numeric ticklen; ticklen := 0.1in;
+pen tickpen; tickpen := pencircle scaled 1;
def modstar(expr numpoints,numbers,numstar) =
picture modfigure;
if (modcircle = true):
@@ -80,6 +84,23 @@ modfigure := image(draw fullcircle scaled 1in withpen modcirclepen;);
else:
modfigure := image();
fi;
+picture modtickpic;
+if (modticks = true):
+modtickpic := image(
+pair tickstart[]; pair tickend[];
+tickstart[0] = (0,0) shifted (0,0.5in);
+tickend[0] = tickstart[0] shifted (0,ticklen);
+draw tickstart[0]--tickend[0] withpen tickpen;
+for i=1 upto (nummodticks-1):
+tickstart[i] = tickstart[i-1] rotatedaround
+((0,0), (360/nummodticks));
+tickend[i] = tickend[i-1] rotatedaround
+((0,0), (360/nummodticks));
+draw tickstart[i]--tickend[i] withpen tickpen;
+endfor;
+);
+addto modfigure also modtickpic;
+fi
pickup modshapepen;
pair p[]; pair q[];
picture addition;
@@ -120,6 +141,23 @@ modfigure := image(draw fullcircle scaled 1in withpen modcirclepen);
else:
modfigure := image();
fi
+picture modtickpic;
+if (modticks = true):
+modtickpic := image(
+pair tickstart[]; pair tickend[];
+tickstart[0] = (0,0) shifted (0,0.5in);
+tickend[0] = tickstart[0] shifted (0,ticklen);
+draw tickstart[0]--tickend[0] withpen tickpen;
+for i=1 upto (nummodticks-1):
+tickstart[i] = tickstart[i-1] rotatedaround
+((0,0), (360/nummodticks));
+tickend[i] = tickend[i-1] rotatedaround
+((0,0), (360/nummodticks));
+draw tickstart[i]--tickend[i] withpen tickpen;
+endfor;
+);
+addto modfigure also modtickpic;
+fi
pair p[]; pair q[];
picture addition;
pickup modshapepen;
diff --git a/Master/texmf-dist/source/metapost/shapes/shapes.dtx b/Master/texmf-dist/source/metapost/shapes/shapes.dtx
index ab1b14cfb28..9a7c4b2125a 100644
--- a/Master/texmf-dist/source/metapost/shapes/shapes.dtx
+++ b/Master/texmf-dist/source/metapost/shapes/shapes.dtx
@@ -193,6 +193,37 @@
% Both |modcirclepen| and |modshapepen| default to
% |pencircle scaled 1|.
%
+% We can also put ticks around the outside of the circle,
+% at whatever intervals we want. The parameters here are
+% \DescribeMacro{modticks}|modticks|, which is a boolean set
+% to |false| by default. Set it to |true| if you want
+% ticks. You can control the number of ticks with
+% \DescribeMacro{nummodticks}|nummodticks|, which defaults
+% to twelve. You can control the length of those ticks with
+% \DescribeMacro{ticklen}|ticklen|, which defaults to
+% |0.1in|. Finally, you can control the pen that is used to
+% draw the ticks, which is \DescribeMacro{tickpen}|tickpen|,
+% which defaults to |pencircle scaled 1|:
+%
+% \demonstrate{%
+% \hbox{|nummodticks := 6;|}
+% \hbox{|ticklen := 0.2in;|}
+% \hbox{|modticks := true;|}
+% \hbox{|tickpen := pensquare scaled 2;|}
+% \hbox{|modshapepen := pensquare scaled 4;|}
+% \hbox{|modfig(4,0);|}
+% \hbox{|draw modfigure;|}
+% }{%
+% \begin{mpost}
+% nummodticks := 6;
+% ticklen := 0.2in;
+% modticks := true;
+% tickpen := pensquare scaled 2;
+% modshapepen := pensquare scaled 4;
+% modfig(4,0); draw modfigure;
+% \end{mpost}
+% }%
+%
% We can do essentially the same thing with reentrant star
% figures with |modstar|. Unlike |modfig|, |modstar| takes
% \emph{three} arguments: the number of vertices, whether
@@ -330,6 +361,10 @@ enddef;
boolean modcircle; modcircle := true;
pen modcirclepen; modcirclepen := pencircle scaled 1;
pen modshapepen; modshapepen := pencircle scaled 1;
+boolean modticks; modticks := false;
+numeric nummodticks; nummodticks := 12;
+numeric ticklen; ticklen := 0.1in;
+pen tickpen; tickpen := pencircle scaled 1;
def modstar(expr numpoints,numbers,numstar) =
picture modfigure;
if (modcircle = true):
@@ -337,6 +372,23 @@ def modstar(expr numpoints,numbers,numstar) =
else:
modfigure := image();
fi;
+ picture modtickpic;
+ if (modticks = true):
+ modtickpic := image(
+ pair tickstart[]; pair tickend[];
+ tickstart[0] = (0,0) shifted (0,0.5in);
+ tickend[0] = tickstart[0] shifted (0,ticklen);
+ draw tickstart[0]--tickend[0] withpen tickpen;
+ for i=1 upto (nummodticks-1):
+ tickstart[i] = tickstart[i-1] rotatedaround
+ ((0,0), (360/nummodticks));
+ tickend[i] = tickend[i-1] rotatedaround
+ ((0,0), (360/nummodticks));
+ draw tickstart[i]--tickend[i] withpen tickpen;
+ endfor;
+ );
+ addto modfigure also modtickpic;
+ fi
pickup modshapepen;
pair p[]; pair q[];
picture addition;
@@ -377,6 +429,23 @@ def modfig(expr numpoints,numbers) =
else:
modfigure := image();
fi
+ picture modtickpic;
+ if (modticks = true):
+ modtickpic := image(
+ pair tickstart[]; pair tickend[];
+ tickstart[0] = (0,0) shifted (0,0.5in);
+ tickend[0] = tickstart[0] shifted (0,ticklen);
+ draw tickstart[0]--tickend[0] withpen tickpen;
+ for i=1 upto (nummodticks-1):
+ tickstart[i] = tickstart[i-1] rotatedaround
+ ((0,0), (360/nummodticks));
+ tickend[i] = tickend[i-1] rotatedaround
+ ((0,0), (360/nummodticks));
+ draw tickstart[i]--tickend[i] withpen tickpen;
+ endfor;
+ );
+ addto modfigure also modtickpic;
+ fi
pair p[]; pair q[];
picture addition;
pickup modshapepen;