summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-12-08 00:27:12 +0000
committerKarl Berry <karl@freefriends.org>2010-12-08 00:27:12 +0000
commitec292c03bd7f22b6c53cc292304730e8a07b10b0 (patch)
tree55a168e031f997a8695acc057db2a8db140c92bd /Master/texmf-dist
parent8eec1138666490fba3cabc5da0e8bbba772373c0 (diff)
new mp package threeddice (8dec10)
git-svn-id: svn://tug.org/texlive/trunk@20675 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/metapost/threeddice/README39
-rw-r--r--Master/texmf-dist/doc/metapost/threeddice/threeddice-doc.pdfbin0 -> 116376 bytes
-rw-r--r--Master/texmf-dist/doc/metapost/threeddice/threeddice-doc.tex139
-rw-r--r--Master/texmf-dist/metapost/threeddice/threeddice.mp261
4 files changed, 439 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/metapost/threeddice/README b/Master/texmf-dist/doc/metapost/threeddice/README
new file mode 100644
index 00000000000..147846dc04e
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/threeddice/README
@@ -0,0 +1,39 @@
+Files: threeddice.mp, threeddice-doc.tex, threeddice-doc.pdf
+
+Purpose:
+
+ The file threeddice.mp consists of MetaPost code to produce pictures of
+ dice with one, two, or three faces visible.
+
+Licence:
+
+ This material is subject to the LaTeX Project Public Licence. See
+ http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
+ for the details of that licence.
+
+Usage:
+
+ Run mpost on threeddice.mp. If your mpost has version at least 0.9,
+ this will produce 26 EPS files named die3d-1.mps through
+ die3d-456.mps. If your mpost is too old the filenames will be threeddice.1
+ through threeddice.456.
+
+ The digits indicate which faces are showing. For two digits, the first
+ digit represents the face on top, the second represents the front face
+ (visually below the first). For three digits, the first is the face on
+ top, the second is the face below and left of that, and the third is
+ below and right.
+
+ These files can be included in a LaTeX document using the graphics or
+ graphicx package, or in a plain TeX document using miniltx + graphicx,
+ or the epsf macros.
+
+Documentation:
+
+ See threeddice-doc.pdf for complete documentation. It may be
+ regenerated by running mpost of threeddice.mp followed by running
+ pdflatex (once) on threeddice-doc.tex.
+
+--
+Dan Luecking
+luecking AT-SIGN uark DOT edu
diff --git a/Master/texmf-dist/doc/metapost/threeddice/threeddice-doc.pdf b/Master/texmf-dist/doc/metapost/threeddice/threeddice-doc.pdf
new file mode 100644
index 00000000000..495bf36731f
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/threeddice/threeddice-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/metapost/threeddice/threeddice-doc.tex b/Master/texmf-dist/doc/metapost/threeddice/threeddice-doc.tex
new file mode 100644
index 00000000000..f936b26e282
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/threeddice/threeddice-doc.tex
@@ -0,0 +1,139 @@
+\documentclass{article}
+\usepackage{graphicx}
+\title{The \texttt{threeddice} package}
+\author{Dan Luecking}
+\date{2010/11/30}
+\begin{document}
+
+\catcode`_=12
+{\catcode`\_=\active \global\let_\sb}
+
+\maketitle
+\section{Introduction}
+
+Running \texttt{mpost} on \texttt{threeddice.mp} produces 26 figure files.
+Six of them are are \texttt{die3d-1.mps}%
+ \footnote{If your \texttt{mpost} version is less that 0.9, you will
+ get figure files with names like \texttt{threeddice.1}. You should
+ update your \TeX{} system.}
+through \texttt{die3d-6.mps}. These are pictures of a single die face
+with the number of dots indicated by the numerical part. Three of these
+would look the same if rotated by multiples of $90$ degrees. The other
+three could look different. It is up to the users to perform this
+rotation if they want a different view.
+
+The twelve files with 2-digit numerical part are 3D pictures of dice with
+two faces showing, as if your were looking directly at a horizontal
+edge. You will have to rotate it $\pm90$ degrees if you want the edge to be
+vertical, or $180$ degrees if you prefer the positions of the top and
+front face to be exchanged.
+
+The eight files with 3-digit numerical suffix are 3D pictures of dice with
+three faces showing, as if your were looking directly at one of the
+corners. They show a top face and a left and right face flanking a
+vertical edge. You can get 16 other views by rotating them $\pm120$
+degrees. These rotations put one of the side faces on top.
+
+\section{Modifications}
+
+These figures were taken from an actual right handed die, and are all
+the permissable views of such a die, apart from size of dots and the
+actual orientation of the patterns of dots. As near as I could determine
+from internet searches, there are no official standards for the
+following.
+\begin{itemize}
+ \item The 2-spot face has dots in opposite corners, but which two
+ corners? On my die, if the 1-spot is on top, the 2-spot to the
+ left and the 3-spot to the right (figure
+ \texttt{die3d-123.mps}), the dots on the 2-spot face are in
+ upper left and lower right. It seems it could just as well have
+ been the other two corners.
+
+ \item Similar question for the 3-spot face: three dots in a diagonal
+ between opposite corners, but which two corners? In the previous
+ example (figure \texttt{die3d-123.mps}), the diagonal is from
+ lower left to upper right.
+
+ \item The 6-spot face has two lines of three, parallel to two edges,
+ but which two edges? In \texttt{die3d-246.mps} the lines of dots are
+ horizontal, but it seems they could just as well have been
+ vertical.
+\end{itemize}
+
+If you want some other orientation of these faces you will need to edit
+\texttt{threeddice.mp}: for the 2-spot face exchange the definitions of
+\texttt{pips2} and \texttt{pips7}; for the 3-spot face exchange
+\texttt{pips3} and \texttt{pips8}; for the 6-spot face exchange
+\texttt{pips6} and \texttt{pips11}.
+
+You can also change the size of the dots by giving a different value to
+\texttt{dot_diam}. The dice have rounded corners, you can change their
+radius by changing \texttt{corner_rad}. The dots are placed so there is
+at least \texttt{face_margin} of space between the dots and the straight
+edge of the face. You can change this variable as well.
+
+For other effects, you are on your own. A common requirement is that
+faces with fewer dots have larger dots. This is relatively easy to do,
+but requires changing the definitions of the 9 picture variables
+\texttt{pips1} through \texttt{pips11}.
+
+Naturally, the \texttt{graphics} and \texttt{graphicx} packages let you
+scale these as you want. If you would prefer to change the unscaled
+sizes, edit \texttt{threeddice.mp} to change \texttt{die_size} from 1cm to
+the desired size.
+
+Finally, to get views of a left-handed die, simply reflect the views of
+the right-handed die.
+
+\section{Appendix}
+
+\parindent 0pt
+These are the six single faces:
+
+\bigskip
+\includegraphics{die3d-1.mps}\quad
+\includegraphics{die3d-2.mps}\quad
+\includegraphics{die3d-3.mps}\quad
+\includegraphics{die3d-4.mps}\quad
+\includegraphics{die3d-5.mps}\quad
+\includegraphics{die3d-6.mps}
+
+\bigskip
+\filbreak
+The two-faced dice are ugly, so let me first show you the eight
+three-faced dice:
+
+\bigskip
+\includegraphics{die3d-123.mps}\quad
+\includegraphics{die3d-135.mps}\quad
+\includegraphics{die3d-142.mps}\quad
+\includegraphics{die3d-154.mps}
+
+\bigskip
+\includegraphics{die3d-246.mps}\quad
+\includegraphics{die3d-263.mps}\quad
+\includegraphics{die3d-365.mps}\quad
+\includegraphics{die3d-456.mps}
+
+\bigskip
+\filbreak
+Finally, the twelve two-faced dice:
+
+\bigskip
+\includegraphics{die3d-12.mps}\quad
+\includegraphics{die3d-13.mps}\quad
+\includegraphics{die3d-14.mps}\quad
+\includegraphics{die3d-15.mps}\quad
+\includegraphics{die3d-23.mps}\quad
+\includegraphics{die3d-24.mps}
+
+\bigskip
+\includegraphics{die3d-26.mps}\quad
+\includegraphics{die3d-35.mps}\quad
+\includegraphics{die3d-36.mps}\quad
+\includegraphics{die3d-45.mps}\quad
+\includegraphics{die3d-46.mps}\quad
+\includegraphics{die3d-56.mps}
+
+\filbreak
+\end{document}
diff --git a/Master/texmf-dist/metapost/threeddice/threeddice.mp b/Master/texmf-dist/metapost/threeddice/threeddice.mp
new file mode 100644
index 00000000000..29c2700c6ea
--- /dev/null
+++ b/Master/texmf-dist/metapost/threeddice/threeddice.mp
@@ -0,0 +1,261 @@
+% File threeddice.mp
+% Version 1.0
+%%%%%%%%%%%%%%%%%%%%
+numeric dot_diam, corner_rad, face_margin, die_size;
+
+% diameter of a dot
+dot_diam := 1/6;
+
+% distance from edge of face to edge of dot.
+face_margin := dot_diam/2;
+
+% rounded corner radius
+corner_rad := dot_diam/2;
+
+% size of a single die face:
+die_size := 1cm;
+
+% Outline of a face.
+path die_face;
+die_face := (0,corner_rad){down}
+ ..{right}(corner_rad,0)..(1-corner_rad,0){right}
+ ..{up}(1,corner_rad)..(1,1-corner_rad){up}
+ ..{left}(1-corner_rad,1)..(corner_rad,1){left}
+ ..{down}(0,1-corner_rad)..cycle;
+
+% dot shape
+path dot;
+dot := fullcircle scaled dot_diam;
+
+% distance from nearest edge to center of dot:
+numeric dot_shift;
+dot_shift := dot_diam/2 + face_margin;
+
+% Five of 9 locations where a dot could be located.
+pair die_face[];
+
+die_face 1 := ( 0, 1) + dot_shift*( 1,-1); % TL
+die_face 2 := ( 0,.5) + dot_shift*( 1, 0); % TC
+die_face 3 := (.5,.5) ; % CC
+die_face 4 := ( 1,.5) + dot_shift*(-1, 0); % BC
+die_face 5 := ( 1, 0) + dot_shift*(-1, 1); % BR
+
+
+picture pips[];
+pips 1 := pips 2 := nullpicture;
+
+% dot in center
+addto pips 1 contour dot shifted die_face 3;
+
+% dots in TL and BR corners
+addto pips 2 contour dot shifted die_face 1;
+addto pips 2 contour dot shifted die_face 5;
+
+% dots in TR and BL corners
+pips 7 := pips 2 rotatedabout ((.5,.5), 90);
+
+% 3 dots on TL to BR diagonal
+pips 3 := pips 2;
+addto pips 3 also pips 1;
+
+% 3 dots on BL to TR diagonal
+pips 8 := pips3 rotatedabout ((.5,.5),90);
+
+% Dots in all 4 corners
+pips 4 := pips 2;
+addto pips 4 also pips 7;
+
+% dots in all four corners and center
+pips 5 := pips 4;
+addto pips 5 also pips 1;
+
+% 6 dots, 3 dots on top and three on bottom
+pips 6 := pips 4;
+addto pips 6 contour dot shifted die_face 2;
+addto pips 6 contour dot shifted die_face 4;
+
+% 6 dots, 3 at left and 3 at right
+pips 11 := pips6 rotatedabout ((.5,.5),90);
+
+% When three faces are showing, alternates 7, 8 and 11 for 2, 3 and 6 are
+% used when the total of the pips is odd (). This is an ad hoc rule that
+% matches what I see on my reference die.
+vardef pips_sel_iii (expr X)=
+ X if odd pips_total: if (X=2) or (X=3) or (X=6): + 5 fi fi
+enddef;
+%
+% Choices are less easy when only two faces show:
+vardef pips_sel_ii (expr X,Y)=
+ X if ((X=2) and ((Y=3) or (Y=4))) or
+ ((X=3) and ((Y=1) or (Y=6))) or
+ ((X=6) and ((Y=2) or (Y=5))): + 5
+ fi
+enddef;
+
+% for die with 3 faces showing:
+path topface[], llftface, lrtface;
+topface 1 = die_face rotated 45 yscaled (1/sqrt(3));
+llftface = topface 1 rotated 120;
+lrtface = topface 1 rotated -120;
+
+% for die with 2 faces showing:
+path frontface;
+topface 2 := (die_face shifted (-.5,0)) yscaled (1/sqrt(2));
+frontface := topface 2 rotated 180;
+
+pair D[];
+D1 := dir 30;
+D2 := dir 150;
+
+path corner_connect[];
+corner_connect1 := (point 6 of lrtface){up}..{D2}(point 3 of topface 1);
+corner_connect2 := (point 6 of topface 1){-D1}..{down}(point 3 of llftface);
+corner_connect3 := (point 6 of llftface){-D2}..{D1}(point 3 of lrtface);
+corner_connect4 := (point 0 of frontface){up}..(point 3 of topface 2){up};
+corner_connect5 := (point 0 of topface 2){down}..(point 3 of frontface){down};
+
+% Text parameter is for drawing options (transformation, withcolor, etc.);
+% expression parameters are the # of pips on top, left and right.
+def die_three(expr T, L, R) text _do_ =
+ numeric pips_total;
+ pips_total := T + L + R;
+ draw topface 1 _do_;
+ draw llftface _do_;
+ draw lrtface _do_;
+ for n = 1 upto 3:
+ draw corner_connect[n] _do_;
+ endfor
+ draw pips[pips_sel_iii(T)] rotated 45 yscaled (1/sqrt(3)) _do_;
+ draw pips[pips_sel_iii(L)] rotated 45 yscaled (1/sqrt(3)) rotated 120 _do_;
+ draw pips[pips_sel_iii(R)] rotated 45 yscaled (1/sqrt(3)) rotated -120 _do_;
+enddef;
+
+def die_two (expr T, F) text _do_ =
+ draw topface 2 _do_;
+ draw frontface _do_;
+ draw (pips[pips_sel_ii(T,F)] shifted .5left) yscaled (1/sqrt(2)) _do_;
+ draw (pips[pips_sel_ii(F,T)] shifted .5left) yscaled (1/sqrt(2)) rotated 180 _do_;
+ draw corner_connect4 _do_;
+ draw corner_connect5 _do_;
+enddef;
+
+def die_one (expr F) text _do_ =
+ draw die_face _do_;
+ draw pips[F] _do_;
+enddef;
+
+if known outputtemplate:
+ outputtemplate := "die3d-%c.mps";
+elseif known mpversion:
+ filenametemplate "die3d-%c.mps";
+fi
+% The 8 permissible views (up to rotation) with three faces equally
+% visible of a right handed die:
+beginfig(123);
+ die_three(1,2,3) scaled die_size;
+endfig;
+
+beginfig(135);
+ die_three(1,3,5) scaled die_size;
+endfig;
+
+beginfig(154);
+ die_three(1,5,4) scaled die_size;
+endfig;
+
+beginfig(142);
+ die_three(1,4,2) scaled die_size;
+endfig;
+
+beginfig(246);
+ die_three(2,4,6) scaled die_size;
+endfig;
+
+beginfig(263);
+ die_three(2,6,3) scaled die_size;
+endfig;
+
+beginfig(365);
+ die_three(3,6,5) scaled die_size;
+endfig;
+
+beginfig(456);
+ die_three(4,5,6) scaled die_size;
+endfig;
+
+% The 12 permissible views (up to rotation) with only two faces equally
+% visible of a right handed die:
+beginfig(12);
+ die_two(1,2) scaled die_size;
+endfig;
+
+beginfig(13);
+ die_two(1,3) scaled die_size;
+endfig;
+
+beginfig(14);
+ die_two(1,4) scaled die_size;
+endfig;
+
+beginfig(15);
+ die_two(1,5) scaled die_size;
+endfig;
+
+beginfig(23);
+ die_two(2,3) scaled die_size;
+endfig;
+
+beginfig(24);
+ die_two(2,4) scaled die_size;
+endfig;
+
+beginfig(26);
+ die_two(2,6) scaled die_size;
+endfig;
+
+beginfig(35);
+ die_two(3,5) scaled die_size;
+endfig;
+
+beginfig(36);
+ die_two(3,6) scaled die_size;
+endfig;
+
+beginfig(45);
+ die_two(4,5) scaled die_size;
+endfig;
+
+beginfig(46);
+ die_two(4,6) scaled die_size;
+endfig;
+
+beginfig(56);
+ die_two(5,6) scaled die_size;
+endfig;
+
+% The 6 possible single faces
+beginfig(1);
+ die_one(1) scaled die_size;
+endfig;
+
+beginfig(2);
+ die_one(2) scaled die_size;
+endfig;
+
+beginfig(3);
+ die_one(3) scaled die_size;
+endfig;
+
+beginfig(4);
+ die_one(4) scaled die_size;
+endfig;
+
+beginfig(5);
+ die_one(5) scaled die_size;
+endfig;
+
+beginfig(6);
+ die_one(6) scaled die_size;
+endfig;
+
+end