diff options
author | Karl Berry <karl@freefriends.org> | 2018-11-15 22:21:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-11-15 22:21:11 +0000 |
commit | e63759bc8ac77f2a41375c1f4b0ad538d4da86b0 (patch) | |
tree | ae016be60fa150364202593212f6a21828587a55 /Master | |
parent | 2f440ca3dc3a3aa309df9143dfe3ce0c8cc29e7a (diff) |
pst-moire (15nov18)
git-svn-id: svn://tug.org/texlive/trunk@49167 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-moire/README.md | 52 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-moire/examples/psGlassPattern.pdf | bin | 0 -> 1868912 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-moire/examples/psGlassPattern.tex | 38 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-moire/pst-cosine.pro | 31 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-moire/pst-moire-doc.pdf | bin | 2173596 -> 4864569 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-moire/pst-moire-doc.tex | 1521 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-moire/pst-sin.pro | 26 | ||||
-rw-r--r-- | Master/texmf-dist/dvips/pst-moire/pst-moire.pro | 66 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-moire/pst-moire.tex | 274 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pst-moire/pst-moire.sty | 4 |
10 files changed, 1802 insertions, 210 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-moire/README.md b/Master/texmf-dist/doc/generic/pst-moire/README.md index c7a5ef8937f..41dfff0e5c6 100644 --- a/Master/texmf-dist/doc/generic/pst-moire/README.md +++ b/Master/texmf-dist/doc/generic/pst-moire/README.md @@ -1,6 +1,6 @@ # **README** # -# pst-moire v. 1.0 # -# 2018/10/28 # +# pst-moire v. 2.0 # +# 2018/11/16 # Source: pst-moire.tex, pst-moire.sty, pst-moire.pro Authors: Jürgen Gilg, Manuel Luque, Jean-Michel Sarlat @@ -16,6 +16,54 @@ a variety of patterns obtained either by dragging one pattern on another, or by rotating one on the other. Moire effects sometimes look very interesting. This document provides the necessary commands and divers examples. +--- + +# **CHANGES COMPARED TO VERSION 1.0** # + +The documentation is better structured and there were added some more +explanations for each type of moiré + +--- + +The **type=circle** gets two new keys to be more flexible: + + n Number of circles + T Distance between two adjacent circles in mm + +The key **Rmax** is therefore out of effect. The image width/height is now +calculated by *n x T*. + +Scaling can be done by setting the usual PSTricks key **unit=**. + +--- + +The **type=linear** gets two new keys to be more flexible: + + n Number of the lines -1 + T Distance between the middle two adjacent lines in mm + +The key **2 \* Rmax** is the height of the lines. The image width is now +calculated by *n x T*. + +--- + +Adding a new command **\\addtomoirelisttype** + +This is to generate customers patterns to then be used as **type=...** + +--- + +Adding a new section: **Random moirés** + +Showing the effects that occur, when randomly placed dots within a square +overlap by the actions rotation or magnification or both of them. + +Adding a new command **\\psRandomDot** + +--- + +Adding a new section: **Glass-patterns** +Adding a new command **\\psGlassPattern** diff --git a/Master/texmf-dist/doc/generic/pst-moire/examples/psGlassPattern.pdf b/Master/texmf-dist/doc/generic/pst-moire/examples/psGlassPattern.pdf Binary files differnew file mode 100644 index 00000000000..a9a97c4477d --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-moire/examples/psGlassPattern.pdf diff --git a/Master/texmf-dist/doc/generic/pst-moire/examples/psGlassPattern.tex b/Master/texmf-dist/doc/generic/pst-moire/examples/psGlassPattern.tex new file mode 100644 index 00000000000..cea77b6da90 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-moire/examples/psGlassPattern.tex @@ -0,0 +1,38 @@ +\documentclass{article} +\usepackage[a4paper,margin=2cm]{geometry} +\usepackage{pst-moire} +\begin{document} +% la couleur des points du premier calque est choisie avec [linecolor=...] +% la couleur des points du second calque est choisie avec [fillcolor=...] +% function : variable = t +% layer=true : 2 layers displayed , false=> layer 1 only +Problem page 100 : "\emph{The Theory of the Moire Phenomenon}" Volume II, by I. Amidror, published by Springer, + +\textbf{3-18 }\emph{Synthesis of a layer superposition having a predefined fixed locus.} + +\begin{quote}\itshape +``Design layer transformations $\mathbf{g}_1(x,y)$ and $\mathbf{g}_2(x,y)$ that will produce in the superposition of two initially identical random screens a fixed locus consisting of a star-like curve that surrounds the origin as shown in the figure on the front cover of this book. Hint: In this case, you may consider a top-opened conic surface having star-like level lines, such as $z=r(1+0.5\cos5\theta)$, or, possibly, $z=r/(1+0.5\cos5\theta)$, which gives a slightly different star. You may adjust the orientation of the star by replacing $\cos$ by $\sin$ or by $-\sin$, as seems suitable. In order to have this surface intersect the $x,y$ plane along a star, you need to lower it by some constant $z_0$: $z=r(1+0.5\cos5\theta)-z_0$. But if you wish to obtain a more complex surface that intersects the $x,y$ plane on a family of concentric stars, you may consider a surface such as: $z=\sin(r(1+0.5\cos5\theta))$.'' +\end{quote} + +\begin{pspicture}(-8,-8)(8,8) +\psframe*[linecolor=orange](-8,-8)(8,8) +% z=5*r*(1-0.5*sin(5*t*Pi/180))-2.5 +\psGlassPattern[linecolor=red] +\end{pspicture} + +\begin{pspicture}(-8,-8)(8,8) +\psframe*[linecolor=red](-8,-8)(8,8) +% in algebraic notation +% t in degrees, argument sin and cos in radians +% convert *Pi/180 +\psGlassPattern[unit=0.75,dotsize=1pt,dotstyle=square,linecolor={[rgb]{0 0 0.5}},algebraic,function=5*r*(1-0.5*cos(7*t*Pi/180))-2.5] +\end{pspicture} + +\begin{pspicture}(-9,-9)(9,9) +\psframe*[linecolor=cyan](-9,-9)(9,9) +% in algebraic notation +% t in degrees, argument sin and cos in radians +% convert *Pi/180 +\psGlassPattern[unit=1.1,dotsize=1pt,dotstyle=square*,linecolor=black,fillcolor=cyan,algebraic,function=5*r/(1-0.75*sin(5*t*Pi/180))-2.5]% ,layers=false +\end{pspicture} +\end{document} diff --git a/Master/texmf-dist/doc/generic/pst-moire/pst-cosine.pro b/Master/texmf-dist/doc/generic/pst-moire/pst-cosine.pro new file mode 100644 index 00000000000..aff0c34dd2b --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-moire/pst-cosine.pro @@ -0,0 +1,31 @@ +moireDict begin +/pst-cosine { +/amplitud 2.5 def +/period 2 def +/cos1 [ +-8 0.05 8 {/x exch def % 320 pts + x unit + 360 x mul period div cos amplitud mul + } for +] def +% +/drawcos { +newpath +cos1 0 get cos1 1 get moveto +0 2 cos1 length 2 sub {/i exch def + cos1 i get cos1 i 1 add get lineto + } for + stroke +} def +gsave +Runit neg dup +Runit 2 mul dup +rectclip +0 -8 unit translate +nr { + 0 E1 translate + drawcos +} repeat +grestore +} def +end diff --git a/Master/texmf-dist/doc/generic/pst-moire/pst-moire-doc.pdf b/Master/texmf-dist/doc/generic/pst-moire/pst-moire-doc.pdf Binary files differindex 925577f7495..b3b31618533 100644 --- a/Master/texmf-dist/doc/generic/pst-moire/pst-moire-doc.pdf +++ b/Master/texmf-dist/doc/generic/pst-moire/pst-moire-doc.pdf diff --git a/Master/texmf-dist/doc/generic/pst-moire/pst-moire-doc.tex b/Master/texmf-dist/doc/generic/pst-moire/pst-moire-doc.tex index 5e0facd85d4..40601c8e130 100644 --- a/Master/texmf-dist/doc/generic/pst-moire/pst-moire-doc.tex +++ b/Master/texmf-dist/doc/generic/pst-moire/pst-moire-doc.tex @@ -54,16 +54,9 @@ \definecolor{moire2}{rgb}{0.357,0.525,0.13} \definecolor{moire3}{rgb}{0.2,0.05,0.015} \definecolor{moire4}{rgb}{0.070.41 0.255} -\definecolor{Beige} {rgb}{0.96,0.96,0.86} -\definecolor{GrisClair} {rgb}{0.8,0.8,0.8} -\definecolor{GrisTresClair} {rgb}{0.9,0.9,0.9} -\definecolor{OrangeTresPale}{cmyk}{0,0.1,0.3,0} -\definecolor{OrangePale}{cmyk}{0,0.2,0.4,0} -\definecolor{BleuClair}{cmyk}{0.2,0,0,0} -\definecolor{LightBlue}{rgb}{.68,.85,.9} -\definecolor{DarkGreen}{rgb}{0,.85,0} -\definecolor{Copper}{cmyk}{0,0.9,0.9,0.2} + \DeclareSymbolFont{grecquesdroites}{U}{eur}{m}{n} + \DeclareMathSymbol{\BETA}{\mathord}{grecquesdroites}{12} \DeclareMathSymbol{\DELTA}{\mathord}{grecquesdroites}{14} \DeclareMathSymbol{\EPSILON}{\mathord}{grecquesdroites}{15} @@ -83,13 +76,17 @@ \psmoire[type=Gauss,linecolor=red,scale=0.6,rotate=-20] \end{pspicture}} - \let\belowcaptionskip\abovecaptionskip \parindent0pt +\pstheader{pst-sin.pro} +\addtomoirelisttype{sin} +\pstheader{pst-cosine.pro} +\addtomoirelisttype{cosine} + \begin{document} -\title{pst-moire v 1.0} +\title{pst-moire v. 2.0} \subtitle{A PSTricks package to draw moiré patterns} \author{% Jürgen \textsc{Gilg}\\ @@ -102,7 +99,6 @@ \tableofcontents \psset{unit=1cm} - \clearpage \begin{abstract}\parskip4pt\parindent0pt @@ -111,7 +107,6 @@ The \texttt{pst-moire} package makes it possible to very simply create a variety For the interested user, we present a section \textbf{Theory} (see pages~\pageref{sec:theory}-\pageref{sec:theoryEnd}) for the mathematical background of moiré patterns. - \vfill {\small This program can redistributed and/or modified under the terms of the LaTeX Project Public License Distributed from CTAN archives in directory \texttt{macros/latex/base/lppl.txt}; either version 1.3c of the License, or (at your option) any later version.} @@ -134,7 +129,7 @@ For the interested user, we present a section \textbf{Theory} (see pages~\pagere \begin{pspicture}(-3,-3)(3,4) \rput(0,-3){\colorbox{black}{\textcolor{white}{\texttt{type=linear}}}} \rput(0,3){\texttt{Equidistant lines}} -\psmoire[linecolor=blue,type=linear] +\psmoire[type=linear,n=28,T=2,Rmax=2.7,linecolor=blue,scale=1] \end{pspicture} \begin{pspicture}(-3,-3)(3,4) @@ -146,7 +141,8 @@ For the interested user, we present a section \textbf{Theory} (see pages~\pagere \begin{pspicture}(-3,-3)(3,4) \rput(0,-3){\colorbox{black}{\textcolor{white}{\texttt{type=circle}}}} \rput(0,3){\texttt{Concentric circles}} -\psmoire[linecolor=cyan,type=circle] +\psset{unit=0.4} +\psmoire[linecolor=cyan,type=circle,scale=0.5] \end{pspicture} \begin{pspicture}(-3,-3)(3,4) @@ -196,7 +192,7 @@ For the interested user, we present a section \textbf{Theory} (see pages~\pagere \Lcs{psmoire}\OptArgs\Largr{x , y} \end{BDef} -The command \Lcs{psmoire} contains the options \nxLkeyword{type=}, \nxLkeyword{Rmax=}, \nxLkeyword{scale=}, \nxLkeyword{Alpha=}, \nxLkeyword{rotate=}, and \nxLkeyword{E=}. +The command \Lcs{psmoire} contains the options \nxLkeyword{type=}, \nxLkeyword{Rmax=}, \nxLkeyword{scale=}, \nxLkeyword{Alpha=}, \nxLkeyword{rotate=}, \nxLkeyword{E=}, \nxLkeyword{n=} and \nxLkeyword{T=}. The optional argument \Largr{x , y} gives the \texttt{x} and \texttt{y} center of the image. If not chosen $(0,0)$ is taken by default. @@ -204,13 +200,30 @@ The optional argument \Largr{x , y} gives the \texttt{x} and \texttt{y} center o \begin{quote} \begin{tabularx}{\linewidth}{ @{} l >{\ttfamily}l X @{} }\toprule -\textbf{Name} & \textbf{Default} & \textbf{Meaning} \\\midrule +\textbf{Name} & \textbf{Default} & \textbf{Meaning}\\\midrule \Lkeyword{type} & Fresnel & The type of pattern\\ -\Lkeyword{Rmax} & 6 & The largest radius of the circles (in cm)\\ -\Lkeyword{scale} & 1 & Scaling factor for the image\\ -\Lkeyword{Alpha} & 70 & Slope of the lines for \verb+[type=Gauss]+\\ -\Lkeyword{rotate} & 0 & Rotation of the figure in degrees.\\ -\Lkeyword{E} & 0.25& Distance between two lines for \verb+[type=Gauss]+\\ +%% +\Lkeyword{rotate} & 0 & Rotation angle of the pattern (in degrees).\\ +%% +\Lkeyword{Rmax} & 6 & For \verb+type=Gauss+ -- image dimensions: \verb+(-Rmax,-Rmax)*(Rmax,Rmax)+\\ + & & For \verb+type=linear+ -- \verb+2*Rmax+ is the length of the lines\\ + & & For \verb+type=radial+ -- maximal radii length\\ + & & all (in cm)\\ +%% +\Lkeyword{scale} & 1 & Scaling factor for the image\\ + & & available for the types: \verb+type=Fresnel/Gauss/Newton/dot/chess+\\ +%% +\Lkeyword{Alpha} & 70 & Slope of the lines (in degrees): \\ + & & for \verb+type=Gauss+ only\\ +%% +\Lkeyword{E} & 0.25 & x-Distance between two points on the Gaussian curve (in cm): \\ + & & for \verb+type=Gauss+ only\\ +%% +\Lkeyword{n} & 30 & Number of circles/lines: \\ + & & for \verb+type=circle+, \verb+type=linear+ only.\\ +%% +\Lkeyword{T} & 2 & Distance between two adjacent circles/lines (in mm): \\ + & & for \verb+type=circle+, \verb+type=linear+ only.\\ \bottomrule \end{tabularx} \end{quote} @@ -225,52 +238,321 @@ We set the type of pattern like: \texttt{type=Gauss} (for example). \psmoire[options,type=Gauss](x,y) \end{verbatim}} -If no position coordinate is specified, the center of the image is placed at $(0,0)$. The thickness parameter does not effect the following types: +For the types that are not affected by \texttt{scale}, simply use the PSTricks key \verb+unit=+. + +If no position coordinate is specified, the center of the image is placed at $(0,0)$. The PSTricks thickness key \verb+linewidth=+ does not affect the following types: \verb+Fresnel+, \verb+Newton+ and \verb+radial+ \newpage +\section{The command \Lcs{addtomoirelisttype}} + +\begin{BDef} +\Lcs{addtomoirelisttype}\Largb{name} +\end{BDef} + +The command \Lcs{addtomoirelisttype} only comes with one mandatory argument---the name the customer chooses. + +If we like to generate our own pattern we can achieve this by using the command \\ +\Lcs{addtomoirelisttype}\Largb{name} within the preamble which then references to a file named +\begin{verbatim} +pst-name.pro +\end{verbatim} +where the prefix \verb+pst-+ is automatically generated. This file we need to code ourselves in PostScript language, save within the working folder and then load it within the preamble like +\begin{verbatim} +\pstheader{pst-name.pro} +\addtomoirelisttype{name} +\end{verbatim} + + +\subsection{How to make a custom moiré types} + +\subsubsection{Sinosoidal pattern} + +\[ +y=a\sin(2\pi\frac{x}{T}) +\] +\begin{center} +\begin{pspicture}[showgrid](-4,-3)(4,3) +\pstVerb{/amplitude 1 def /periode 6.28318530718 def}% +\psplot[plotpoints=1000,algebraic]{-4}{4}{amplitude*sin(2*Pi*x/periode)} +\end{pspicture} +\end{center} +For the grating of equidistant vertical lines we have: $x=ne$, $e$ displacement and $n$ an integer. + +The ordinates of the intersection points are: $y_n=a\sin(2\pi\frac{ne}{T})$. Within the following figure, the displacement is set to 0.25. +\begin{center} +\begin{pspicture}[showgrid](-4,-3)(4,3) +\pstVerb{/amplitude 1 def /periode 6.28318530718 def}% +\psplot[plotpoints=1000,algebraic]{-4}{4}{amplitude*sin(2*Pi*x/periode)} +\psplot[plotpoints=33,algebraic,linestyle=none,showpoints]{-4}{4}{amplitude*sin(2*Pi*x/periode)}% +\multido{\r=-4+0.25}{33}{ +\psline(\r,-3)(\r,3)} +\end{pspicture} +\end{center} +We determine the equations of the straight lines passing through these points and which are inclined by an angle $\alpha$ with respect to the horizontal. This is to setup with the key \texttt{Alpha=} (in degrees). + +The general equation of such a line is given by: $y=x\tan(\alpha)+b$, we determine $b$ to go through one of the previous points. +\[ +ne\tan(\alpha)+b=a\sin(2\pi\frac{ne}{T}) +\] +and thus we get $b$. +\[ +b=a\sin(2\pi\frac{ne}{T})-ne\tan(\alpha) +\] +For every value of $n$ we receive one line. +\[ +y=x\tan(\alpha)+a\sin(2\pi\frac{ne}{T})-ne\tan(\alpha) +\] +We draw some lines, setting $a=1$, $T=2\pi$, $-20<n<+20$, $e=0.5$ and $\alpha=70^{\mathrm{o}}$ +\begin{center} +\begin{pspicture*}[showgrid](-6,-3)(6,3) +\pstVerb{/amplitude 1 def /periode 6.28318530718 0.75 mul def + /E1 0.25 def + /Alpha 70 def + /m1 {Alpha dup sin exch cos div} bind def % pente de la droite + }% +\psplot[plotpoints=1000,algebraic]{-5}{5}{amplitude*sin(2*Pi*x/periode)} +\psplot[plotpoints=41,algebraic,linestyle=none,showpoints]{-5}{5}{amplitude*sin(2*Pi*x/periode)}% +\multido{\i=-20+1}{41}{% +\pnode(! /xi \i\space E1 mul def % x + xi + amplitude 360 periode div xi mul sin mul){A} + \psdot(A) +\rput(A){\psline(! -4 -4 m1 mul)(! 4 4 m1 mul)} + } +\end{pspicture*} +\end{center} +Now we need to code that in PostScript and name that file \texttt{pst-sin.pro} and save it within the working folder. +{\tiny\begin{verbatim} +moireDict begin +/pst-sin { +0 0 translate +2 dict begin +/A1 0.5 def % amplitude +/TRAME { +-50 E1 2 mul 50 {/n exch def +gsave + n E1 mul unit % x + A1 unit 360 Tr div n E1 mul mul sin mul % y + translate + linecolor + linewidth + -6 unit -6 m mul unit moveto + 6 unit 6 m mul unit lineto + stroke +grestore + } for +} def +Runit neg dup +Runit 2 mul dup +rectclip + TRAME +end +} def +end +\end{verbatim}} + + +\newpage + + +This results within the following custom generated pattern. +\begin{center} +\begin{pspicture}(-5,-6)(5,6) +\psset{Rmax=5,T=2,E=0.2} +\psmoire[type=sin,rotate=2] +\psmoire[type=sin,rotate=-2] +\end{pspicture} +\end{center} +{\small\begin{verbatim} +\begin{pspicture}(-5,-6)(5,6) +\psset{Rmax=5,T=2,E=0.2} +\psmoire[type=sin,rotate=2] +\psmoire[type=sin,rotate=-2] +\end{pspicture} +\end{verbatim}} +\textbf{Note:} Now we can use our custom generated \texttt{type=sin} with all the other options available. + + +\newpage + + +\subsubsection{Cosine pattern} + +Here another PostScript code saved with the file name \texttt{pst-cosine.pro} within the working folder. +{\tiny\begin{verbatim} +moireDict begin +/pst-cosine { +/amplitud 2.5 def +/period 2 def +/cos1 [ +-8 0.05 8 {/x exch def % 320 pts + x unit + 360 x mul period div cos amplitud mul + } for +] def +% +/drawcos { +newpath +cos1 0 get cos1 1 get moveto +0 2 cos1 length 2 sub {/i exch def + cos1 i get cos1 i 1 add get lineto + } for + stroke +} def +gsave +Runit neg dup +Runit 2 mul dup +rectclip +0 -8 unit translate +nr { + 0 E1 translate + drawcos +} repeat +grestore +} def +end +\end{verbatim}} + +Setting into the preamble: +\begin{verbatim} +\pstheader{pst-cosine.pro} +\addtomoirelisttype{cosine} +\end{verbatim} + +\textbf{Example 1:} + +\begin{minipage}[t]{12cm}\kern0pt +\begin{pspicture}(-6,-6)(6,6) +\psset{Rmax=5,linewidth=1pt} +\psframe(-5,-5)(5,5) +\psmoire[% +type=cosine, +E=3, +n=400, +rotate=0] +\psmoire[% +type=linear, +T=0.85, +rotate=-90, +n=120, +linecolor=red](1,1) +\end{pspicture} +\end{minipage} +\hfill +\begin{minipage}[t]{5cm}\kern0pt +{\small\begin{verbatim} +\begin{pspicture}(-6,-6)(6,6) +\psset{Rmax=5,linewidth=1pt} +\psframe(-5,-5)(5,5) +\psmoire[% +type=cosine, +E=3, +n=400, +rotate=0] +\psmoire[% +type=linear, +T=0.85, +rotate=-90, +n=120, +linecolor=red](1,1) +\end{pspicture} +\end{verbatim}} +\end{minipage} + + +\newpage + + +\textbf{Example 2:} + +\begin{minipage}[t]{12cm}\kern0pt +\begin{pspicture}(-6,-6)(6,6) +\psset{Rmax=5,linewidth=1pt} +\psframe(-5,-5)(5,5) +\psmoire[% +type=cosine, +E=3, +n=400, +rotate=0] +\psmoire[% +type=linear, +T=1.2, +rotate=100, +n=80, +linecolor=red] +\end{pspicture} +\end{minipage} +\begin{minipage}[t]{5cm}\kern0pt +{\small\begin{verbatim} +\begin{pspicture}(-6,-6)(6,6) +\psset{Rmax=5,linewidth=1pt} +\psframe(-5,-5)(5,5) +\psmoire[% +type=cosine, +E=3, +n=400, +rotate=0] +\psmoire[% +type=linear, +T=1.2, +rotate=100, +n=80, +linecolor=red] +\end{pspicture} +\end{verbatim}} +\end{minipage} + + +\newpage + + \section{Opacity and Blendmodes} If we want to highlight the color of the intersecting area of the lines of two or more overlapping moiré patterns differently, we can either use \emph{opacity} or \emph{blendmodes}. + \subsection{Opacity} In case we want to add some opacity to the lines of the moiré patterns, we just set, i. e. \begin{verbatim} \pstVerb{% -0.45 .setopacityalpha +0.25 .setopacityalpha } \end{verbatim} within the \verb+\pspicture+ environment. -Distiller users set: +Distiller users set instead: \begin{verbatim} \pstVerb{% -[ /ca 0.45 /CA 0.45 /SetTransparency pdfmark +[ /ca 0.25 /CA 0.25 /SetTransparency pdfmark } \end{verbatim} -\textbf{Note:} The value of the opacity needs to be between 0 and 1. +\textbf{Note:} The value for the opacity needs to be between 0 and 1. \begin{center} \begin{pspicture}(-6,-6)(6,6) \pstVerb{% -0.45 .setopacityalpha +0.25 .setopacityalpha +} +\psmoire[type=linear,linecolor=blue,linewidth=3pt,n=60] +\psmoire[type=linear,linecolor=red,linewidth=3pt,rotate=90,n=60] +\pstVerb{% +1 .setopacityalpha } -\psmoire[type=linear,linecolor=blue,linewidth=3pt] -\psmoire[type=linear,linecolor=green,linewidth=3pt,rotate=90] \end{pspicture} \end{center} {\tiny\begin{verbatim} \begin{pspicture}(-6,-6)(6,6) \pstVerb{% -0.45 .setopacityalpha +0.25 .setopacityalpha } -\psmoire[type=linear,linecolor=blue,linewidth=3pt] -\psmoire[type=linear,linecolor=green,linewidth=3pt,rotate=90] +\psmoire[type=linear,linecolor=blue,linewidth=3pt,n=60] +\psmoire[type=linear,linecolor=red,linewidth=3pt,rotate=90,n=60] \end{pspicture} \end{verbatim}} @@ -293,7 +575,7 @@ We just set, i. e. \end{verbatim} within the \verb+\pspicture+ environment. -Distiller users set: +Distiller users set instead: \begin{verbatim} \pstVerb{% [ /BM /Darken /ca 1 /CA 1 /SetTransparency pdfmark @@ -305,8 +587,8 @@ Distiller users set: \pstVerb{% /Darken .setblendmode } -\psmoire[type=linear,linecolor=blue,linewidth=3pt] -\psmoire[type=linear,linecolor=green,linewidth=3pt,rotate=90] +\psmoire[type=linear,linecolor=blue,linewidth=3pt,n=60] +\psmoire[type=linear,linecolor=green,linewidth=3pt,rotate=90,n=60] \end{pspicture} \end{center} {\small\begin{verbatim} @@ -314,8 +596,8 @@ Distiller users set: \pstVerb{% /Darken .setblendmode } -\psmoire[type=linear,linecolor=blue,linewidth=3pt] -\psmoire[type=linear,linecolor=green,linewidth=3pt,rotate=90] +\psmoire[type=linear,linecolor=blue,linewidth=3pt,n=60] +\psmoire[type=linear,linecolor=green,linewidth=3pt,rotate=90,n=60] \end{pspicture} \end{verbatim}} @@ -323,33 +605,39 @@ Distiller users set: \newpage -\section{Examples} +\section{The moiré types} + +\subsection{\texttt{type=Fresnel}} + +The \texttt{type=Fresnel} consists of concentric circles with incrementing radii of $\sqrt{n}$. The maximum radius is given by \texttt{Rmax}. The linewidth is fixed (cannot be changed by \texttt{linewidth=}), due to the thickness of the circle varies. + +\textbf{Example 1: Overlapping pattern with centers close to each other} \begin{center} -\begin{pspicture}(-4,-4)(4,4) -\rput(0,4){\textsf{Bands of Fresnel 1}} +\begin{pspicture}(-3,-3)(3,3) \psmoire[linecolor=red,scale=0.5](-0.2,0) \psmoire[linecolor=red,scale=0.5](0.2,0) \end{pspicture} \end{center} {\small\begin{verbatim} -\begin{pspicture}(-4,-4)(4,4) +\begin{pspicture}(-3,-3)(3,3) \psmoire[linecolor=red,scale=0.5](-0.2,0) \psmoire[linecolor=red,scale=0.5](0.2,0) \end{pspicture} \end{verbatim}} -% + +\textbf{Example 2: Overlapping pattern with centers far from each other} + \begin{center} -\begin{pspicture}(-5,-4)(5,4) -\rput(0,4){\textsf{Bands of Fresnel 2}} +\begin{pspicture}(-5,-3)(5,3) \psmoire[linecolor={[rgb]{0.15 0.75 0.15}},scale=0.5](-1.5,0) \psmoire[linecolor={[rgb]{0.15 0.75 0.15}},scale=0.5](1.5,0) \end{pspicture} \end{center} {\small\begin{verbatim} -\begin{pspicture}(-4,-4)(4,4) -\psmoire[linecolor=green,scale=0.5](-1.5,0) -\psmoire[linecolor=green,scale=0.5](1.5,0) +\begin{pspicture}(-5,-3)(5,3) +\psmoire[linecolor={[rgb]{0.15 0.75 0.15}},scale=0.5](-1.5,0) +\psmoire[linecolor={[rgb]{0.15 0.75 0.15}},scale=0.5](1.5,0) \end{pspicture} \end{verbatim}} @@ -357,23 +645,80 @@ Distiller users set: \newpage -\begin{center} -\begin{pspicture}(-4,-4)(4,4) -\rput(0,4){\textsf{Lines}} -\psmoire[scale=0.5,type=linear,rotate=5,linewidth=0.1] -\psmoire[scale=0.5,type=linear,rotate=-5,linewidth=0.1] +\subsection{\texttt{type=linear}} + +The \texttt{type=linear} offers two more keys to be more flexible: +\begin{verbatim} +n Number of lines -1 Default: 30 +T Distance between the middle of two lines in mm Default: 2 +\end{verbatim} +The height of the lines is given by: \texttt{2*Rmax}, the width of the image is \texttt{n*T} + +If we like a distance that is equal to the thickness of the line, we set: +\begin{verbatim} +linewidth=T/2 +\end{verbatim} +If \texttt{T=2}, we set \texttt{linewidth=0.1}. + +\textbf{Example 1: Basic pattern with the keys \texttt{n=} and \texttt{T=}} + +\begin{minipage}[t]{8cm}\kern0pt +\begin{pspicture}(-3,-3)(3,3) +\psmoire[type=linear,n=70,T=1,Rmax=3] \end{pspicture} -\end{center} {\small\begin{verbatim} -\begin{pspicture}(-4,-4)(4,4) -\psmoire[scale=0.5,type=linear,rotate=5,linewidth=0.1] -\psmoire[scale=0.5,type=linear,rotate=-5,linewidth=0.1] +\begin{pspicture}(-3,-3)(3,3) +\psmoire[type=linear,n=70,T=1,Rmax=3] \end{pspicture} \end{verbatim}} -% +\end{minipage} +\hfill +\begin{minipage}[t]{8cm}\kern0pt +\begin{pspicture}(-3,-3)(3,3) +\psmoire[type=linear,n=30,T=2,Rmax=3] +\end{pspicture} +{\small\begin{verbatim} +\begin{pspicture}(-3,-3)(3,3) +\psmoire[type=linear,n=30,T=2,Rmax=3] +\end{pspicture} +\end{verbatim}} +\end{minipage} + +\bigskip + +\textbf{Example 2: Overlapping patterns} + +\begin{minipage}[t]{8cm}\kern0pt +\psscalebox{0.7}{% +\begin{pspicture}(-5,-5)(5,7) +\psset{linewidth=0.08,type=linear,n=50,Rmax=5} +\psmoire[T=2,n=55] +\psmoire[T=2.1,linecolor=red](1.8,2) +\end{pspicture}} +\end{minipage} +\hfill +\begin{minipage}[t]{8cm}\kern0pt +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,7) +\psset{linewidth=0.08,type=linear,n=50,Rmax=5} +\psmoire[T=2,n=55] +\psmoire[T=2.1,linecolor=red](1.8,2) +\end{pspicture} +\end{verbatim}} +\end{minipage} + + +\newpage + + +\subsection{\texttt{type=radial}} + +The \texttt{type=radial} consists of radial rays---to be more precise, it consists of 120 sectors. The maximal radius of the sectors is given by \texttt{Rmax=}. + +\textbf{Example 1: Overlapping patterns with centers close to each other} + \begin{center} \begin{pspicture}(-4,-4)(4,4.5) -\rput(0,4.25){\textsf{Radii}} \psmoire[Rmax=4,type=radial](-0.25,0) \psmoire[Rmax=4,type=radial](0.25,0) \end{pspicture} @@ -389,13 +734,15 @@ Distiller users set: \newpage +\subsection{\texttt{type=Bouasse}} + +For some detailed information about the \texttt{type=Bouasse} as pattern, see page~\pageref{sec:Bouasse}. + \begin{center} \psset{scale=0.7,linewidth=0.75mm} \begin{pspicture}(-6,-5)(6,5) -\rput(0,5.25){\textsf{Bouasse}} \psmoire[type=Bouasse,rotate=10,Rmax=5] \psmoire[type=Bouasse,rotate=170,Rmax=5] -%\psline[linecolor=red,linewidth=0.25mm](0,-6)(0,6) \end{pspicture} \end{center} @@ -405,85 +752,258 @@ Distiller users set: \psmoire[type=Bouasse,rotate=170] \end{pspicture} \end{verbatim}} -% -\begin{center} -\psset{linewidth=1mm} -\begin{pspicture}(-6,-4)(6,4) -\rput(0,4.25){\textsf{Concentric circles}} -\psmoire[Rmax=4,type=circle](-0.5,0) -\psmoire[Rmax=4,type=circle](0.5,0) -\end{pspicture} -\end{center} + +\newpage + + +\subsection{\texttt{type=circle}} + +The \texttt{type=circle} offers two more keys to be more flexible: +\begin{verbatim} +n Number of circles Default: 30 +T Distance between two adjacent circles in mm Default: 2 +\end{verbatim} +The key \texttt{Rmax} has no effect. The maximal width/height of the image is calculated by: \texttt{n*T}, by default: $30\cdot 2=60\,\text{mm}=6\,\text{cm}$. Another way could be to use the default values and play with the usual PSTricks key \texttt{unit=}. + +The idea to make that type more flexible came from example 11.8 page 373 of the book ``\emph{The Theory of the Moiré Phenomenon}'' of Isaac Amidror. + +\textbf{Example 1: Basic pattern with the keys \texttt{n=} and \texttt{T=}} + +\begin{minipage}[t]{8cm}\kern0pt +\begin{pspicture}(-3,-3)(3,3) +\psmoire[type=circle,n=15,T=1] +\end{pspicture} {\small\begin{verbatim} -\begin{pspicture}(-5,-5)(5,5) -\psmoire[Rmax=5,type=circle](-0.2,0) -\psmoire[Rmax=5,type=circle](0.2,0) +\begin{pspicture}(-3,-3)(3,3) +\psmoire[type=circle,n=15,T=1] \end{pspicture} \end{verbatim}} +\end{minipage} +\hfill +\begin{minipage}[t]{8cm}\kern0pt +\begin{pspicture}(-3,-3)(3,3) +\psmoire[type=circle,n=15,T=2] +\end{pspicture} +{\small\begin{verbatim} +\begin{pspicture}(-3,-3)(3,3) +\psmoire[type=circle,n=15,T=2] +\end{pspicture} +\end{verbatim}} +\end{minipage} + +\bigskip + +\textbf{Example 2: Overlapping patterns} + +The following moiré is given by a superposition of two circular gratings, however their line spacings \texttt{T1} and \texttt{T2} are slightly different and they are shifted by $+/-(x_0,y_0)$ from its origin. + +\begin{minipage}[t]{8cm}\kern0pt +% With two circular patterns. +% T1 and T2 are slightly different. +% r1=m*T1 : T1=1 mm +% r2=n*T2 : T2=1.1 mm +% The moirés are: Ovals of Descartes +% demonstration of the figure 11.8 page 373 of +% "The Theory of the Moiré Phenomenon" de Isaac Amidror +% Volume 1 : Periodic Layers +% The image is found on the front cover of the book +\psscalebox{0.85}{% +\begin{pspicture}(-5,-5)(4,4.5) +\psclip{\psframe(-5,-6)(5,4)} +\psmoire[linecolor=red,type=circle,T=1,n=100](0,1)% +\endpsclip% +\rput(0.2,1.2){% +\psclip{\psframe(-4.8,-7)(5.2,3)} +\psmoire[type=circle,T=1.1,n=100]% +\endpsclip}% +\end{pspicture}} +\end{minipage} +\hfill +\begin{minipage}[t]{8cm}\kern0pt +{\footnotesize\begin{verbatim} +% With two circular patterns. +% T1 and T2 are slightly different. +% r1=m*T1 : T1=1 mm +% r2=n*T2 : T2=1.1 mm +% The moirés are: Ovals of Descartes +% demonstration of the figure 11.8 page 373 of +% "The Theory of the Moiré Phenomenon" de Isaac Amidror +% Volume 1 : Periodic Layers +% The image is found on the front cover of the book +\begin{pspicture}(-5,-5)(4,4.5) +\psclip{\psframe(-5,-6)(5,4)} +\psmoire[linecolor=red,type=circle,T=1,n=100](0,1)% +\endpsclip% +\rput(0.2,1.2){% +\psclip{\psframe(-4.8,-7)(5.2,3)} +\psmoire[type=circle,T=1.1,n=100]% +\endpsclip}% +\end{pspicture} +\end{verbatim}} +\end{minipage} \newpage -% +\textbf{Example 3: Overlapping patterns} + +The following moiré is given by the superposition of two circular gratings when both gratings are centered at their origins, however their line spacings \texttt{T1} and \texttt{T2} are slightly different. + \begin{center} +\begin{pspicture*}(-5,-5)(5,5) +\psmoire[type=circle,T=1,n=100]% +\psmoire[type=circle,T=1.1,n=100,linecolor=red]% +\end{pspicture*} +\end{center} +{\small\begin{verbatim} +\begin{pspicture*}(-5,-5)(5,5) +\psmoire[type=circle,T=1,n=100]% +\psmoire[type=circle,T=1.1,n=100,linecolor=red]% +\end{pspicture*} +\end{verbatim}} + + +\newpage + + +\subsection{\texttt{type=Gauss}} + +The \texttt{type=Gauss} offers two keys to be more flexible: +\begin{verbatim} +Alpha Slope of the lines Default: 70 +E x-distance between two points + on the Gaussian curve Default: 0.25 +\end{verbatim} +The key \texttt{Alpha=} is self-explanatory---see the following example. For the key \texttt{E=}, see the sketch of the Gaussian curve on page~\pageref{sec:Gauss}. + +\textbf{Example 1: Basic pattern} + +\begin{minipage}[t]{8cm}\kern0pt +\begin{pspicture}(-4,-4)(4,4) +\rput(-3.8,-4){% +\psline[linecolor=red,linewidth=2pt](0;0)(6;50) +\psarc[linecolor=red,linewidth=2pt]{->}(0,0){2}{0}{50} +\rput(1.25;25){\textcolor{red}{\texttt{\textbf{Alpha}}}} +} +\psmoire[Rmax=4,type=Gauss,Alpha=50] +\end{pspicture} +{\small\begin{verbatim} +\begin{pspicture}(-4,-4)(4,4) +\psmoire[Rmax=4,type=Gauss,Alpha=50] +\end{pspicture} +\end{verbatim}} +\end{minipage} +\hfill +\begin{minipage}[t]{8cm}\kern0pt +\begin{pspicture}(-4,-4)(4,4) +\psmoire[Rmax=4,type=Gauss,Alpha=50,E=0.5] +\end{pspicture} +{\small\begin{verbatim} +\begin{pspicture}(-4,-4)(4,4) +\psmoire[Rmax=4,type=Gauss,Alpha=50,E=0.5] +\end{pspicture} +\end{verbatim}} +\end{minipage} + +\bigskip + +\textbf{Example 2: Overlapping patterns} + +\begin{minipage}[t]{8cm}\kern0pt \psset{linewidth=0.5mm,Rmax=4} -\begin{pspicture}(-5,-5)(5,5) -\rput(0,4.5){\textsf{Gauss}} +\begin{pspicture}(-4,-4)(4,4) \psmoire[type=Gauss,rotate=-5,linecolor=red] \psmoire[type=Gauss,rotate=5] \end{pspicture} -\end{center} +\end{minipage} +\hfill +\begin{minipage}[t]{8cm}\kern0pt {\small\begin{verbatim} -\begin{pspicture}(-5,-5)(5,5) -\psmoire[type=Gauss,rotate=-10] -\psmoire[type=Gauss] +\psset{linewidth=0.5mm,Rmax=4} +\begin{pspicture}(-4,-4)(4,4) +\psmoire[type=Gauss,rotate=-5,linecolor=red] +\psmoire[type=Gauss,rotate=5] \end{pspicture} \end{verbatim}} -% +\end{minipage} + + +\newpage + + +\subsection{\texttt{type=square}} + +The \texttt{type=square} consists of equidistant squares with a distance 2 mm each. + +\textbf{Example 1:} + +The following moiré is given by a superposition of two square gratings when both gratings are rotated by $+/-5^\circ$ around its origin. + \begin{center} \psset{linewidth=1mm,scale=0.6} \begin{pspicture}(-4,-4)(4,4) -\rput(0,4){\textsf{Squares}} \psmoire[type=square,rotate=-5] \psmoire[type=square,rotate=5] \end{pspicture} \end{center} {\small\begin{verbatim} +\psset{linewidth=1mm,scale=0.6} +\begin{pspicture}(-4,-4)(4,4) \psmoire[type=square,rotate=-5] \psmoire[type=square,rotate=5] +\end{pspicture} \end{verbatim}} -% \newpage +\subsection{\texttt{type=Newton}} + +The \texttt{type=Newton} consists of concentric squares with incrementing side length of $\sqrt{n}$. The maximum side length is given by \texttt{Rmax}. The linewidth is fixed (cannot be changed by \texttt{linewidth=}), due to the thickness of the squares varies. + +\textbf{Example 1:} + +The following moiré is given by a superposition of two Newton gratings when both gratings are rotated by $+/-2.5^\circ$ around its origin. + \begin{center} \psset{linewidth=0.5mm,scale=0.5} \begin{pspicture}(-4,-4)(4,4) -\rput(0,3.75){\textsf{Squares of Newton}} \psmoire[type=Newton,rotate=-2.5] \psmoire[type=Newton,rotate=2.5] \end{pspicture} \end{center} {\small\begin{verbatim} +\psset{linewidth=0.5mm,scale=0.5} \begin{pspicture}(-4,-4)(4,4) \psmoire[type=Newton,rotate=-2.5] \psmoire[type=Newton,rotate=2.5] \end{pspicture} \end{verbatim}} -% + + +\newpage + + +\subsection{\texttt{type=dot}} + +The \texttt{type=dot} consists of dots bordered within a square of side lengths \texttt{Rmax*Rmax}. The \texttt{dotstyle=} and \texttt{dotsize=} can be individually setup. Its colors can be chosen by the usual PSTricks key \texttt{linecolor}. + +\textbf{Example 1:} + +The following moiré is given by a superposition of two dot gratings when both gratings are rotated by $+/-2.5^\circ$ around its origin. + \begin{center} \psset{Rmax=4} \begin{pspicture}(-4,-4)(4,5) -\rput(0,4.75){\textsf{Point pattern}} \psmoire[type=dot,linecolor=blue,rotate=-2.5] \psmoire[type=dot,rotate=2.5,linecolor=red] \end{pspicture} \end{center} {\small\begin{verbatim} +\psset{Rmax=4} \begin{pspicture}(-5,-5)(5,5) \psmoire[type=dot,linecolor=blue,rotate=-2.5] \psmoire[type=dot,rotate=2.5,linecolor=red] @@ -494,10 +1014,17 @@ Distiller users set: \newpage +\subsection{\texttt{type=chess}} + +The \texttt{type=chess} consists of squares bordered within a square of side lengths \texttt{Rmax*Rmax}. The \texttt{dotstyle=} and \texttt{dotsize=} can be individually setup. Its colors can be chosen by the usual PSTricks key \texttt{linecolor}. + +\textbf{Example 1:} + +The following moiré is given by a superposition of two chess gratings when both gratings are rotated by $+/-5^\circ$ around its origin. + \begin{center} \psset{Rmax=4,dotstyle=square*,dotsize=0.25cm,linecolor={[cmyk]{0 0.81 1 0.6}}} \begin{pspicture}(-4,-4)(4,5) -\rput(0,4.5){\textsf{Chess pattern}} \psmoire[type=chess,rotate=-5] \psmoire[type=chess,rotate=5] \end{pspicture} @@ -509,42 +1036,151 @@ Distiller users set: \psmoire[type=chess,rotate=5] \end{pspicture} \end{verbatim}} -% -\begin{center} -\psset{Rmax=8,linewidth=0.5mm,scale=0.5,linecolor={[rgb]{0.15 0.55 0.15}}} -\begin{pspicture}(-5,-4)(5,5) -\rput(0,4.75){\textsf{Bands of Fresnel + lines}} + + +\newpage + + +\section{Examples of combined moiré patterns} + +\textbf{Example 1:} + +\begin{minipage}[t]{6cm}\kern0pt +\psset{Rmax=8,linewidth=0.5mm,scale=0.5, +linecolor={[rgb]{0.357 0.525 0.13}}} +\begin{pspicture}(-5,-5)(5,5) +\rput(0,4.75){\texttt{type=Fresnel + type=linear}} \psmoire[type=Fresnel] -\psmoire[type=linear] -\psmoire[type=linear](-0.1,0) -% et, \'{e}ventuellement, pour avoir le trait vertical qui manque \`{a} droite -%\psmoire[type=linear,linewidth=0.2mm](0.1,0) +\psmoire[type=linear,n=40] +\psmoire[type=linear,n=41](-0.1,0) \end{pspicture} -\end{center} -{\small\begin{verbatim} -\begin{pspicture}(-4,-4)(4,4) +\end{minipage} +\hfill +\begin{minipage}[t]{7.5cm}\kern0pt +{\footnotesize\begin{verbatim} +\psset{Rmax=8,linewidth=0.5mm,scale=0.5, +linecolor={[rgb]{0.357 0.525 0.13}}} +\begin{pspicture}(-5,-5)(5,5) +\rput(0,4.75){\texttt{type=Fresnel + type=linear}} \psmoire[type=Fresnel] -\psmoire[type=linear] -\psmoire[type=linear](-0.1,0) +\psmoire[type=linear,n=40] +\psmoire[type=linear,n=41](-0.1,0) \end{pspicture} \end{verbatim}} +\end{minipage} + +\bigskip + +\textbf{Example 2:} + +\begin{minipage}[t]{6cm}\kern0pt +\psset{Rmax=8,linewidth=0.5mm,scale=0.5} +\begin{pspicture}(-5,-5)(5,5) +\rput(0,4.75){\texttt{type=Fresnel + type=square}} +\psmoire[type=Fresnel,linecolor=orange] +\psmoire[type=square,linecolor=gray] +\end{pspicture} +\end{minipage} +\hfill +\begin{minipage}[t]{7.5cm}\kern0pt +{\footnotesize\begin{verbatim} +\psset{Rmax=8,linewidth=0.5mm,scale=0.5} +\begin{pspicture}(-5,-5)(5,5) +\rput(0,4.75){\texttt{type=Fresnel + type=square}} +\psmoire[type=Fresnel,linecolor=orange] +\psmoire[type=square,linecolor=gray] +\end{pspicture} +\end{verbatim}} +\end{minipage} \newpage -These rotating moirés were obtained with the use of the \texttt{pst-lens} package. It is the reproduction, with the tools of PSTricks, of the photograph 6, page 137 of the book ``\textit{Les phénomènes naturels}'' of the Library \textbf{Pour la Science}, Berlin (1978). This photograph is accompanied by the following comment: + +\textbf{Example 3:} + +\begin{minipage}[t]{6cm}\kern0pt +\psset{Rmax=8,linewidth=0.5mm,scale=0.5} +\begin{pspicture}(-5,-5)(5,5) +\rput(0,4.75){\texttt{type=Newton + type=square}} +\psmoire[type=Newton,linecolor=blue,rotate=5] +\psmoire[type=square,linecolor=cyan,rotate=-5] +\end{pspicture} +\end{minipage} +\hfill +\begin{minipage}[t]{7.5cm}\kern0pt +{\footnotesize\begin{verbatim} +\psset{Rmax=8,linewidth=0.5mm,scale=0.5} +\begin{pspicture}(-5,-5)(5,5) +\rput(0,4.75){\texttt{type=Newton + type=square}} +\psmoire[type=Newton,linecolor=blue,rotate=5] +\psmoire[type=square,linecolor=cyan,rotate=-5] +\end{pspicture} +\end{verbatim}} +\end{minipage} + +\bigskip + +\textbf{Example 4:} + +\begin{minipage}[t]{6cm}\kern0pt +\psset{Rmax=8,scale=0.5} +\begin{pspicture}(-5,-5)(5,5) +\pstVerb{% +/Multiply .setblendmode +} +\rput(0,4.75){\texttt{type=Fresnel + type=Newton}} +\psmoire[% +type=Fresnel, +linecolor=gray +](-0.05,0) +\psmoire[% +type=Newton, +linecolor=gray!30, +rotate=5 +](0.05,0) +\end{pspicture} +\end{minipage} +\hfill +\begin{minipage}[t]{7.5cm}\kern0pt +{\footnotesize\begin{verbatim} +\psset{Rmax=8,scale=0.5} +\begin{pspicture}(-5,-5)(5,5) +\pstVerb{% +/Multiply .setblendmode +} +\rput(0,4.75){\texttt{type=Fresnel + type=Newton}} +\psmoire[% +type=Fresnel, +linecolor=gray +](-0.05,0) +\psmoire[% +type=Newton, +linecolor=gray!30, +rotate=5 +](0.05,0) +\end{pspicture} +\end{verbatim}} +\end{minipage} + + +\newpage + + +These following rotating moirés were obtained with the use of the \texttt{pst-lens} package. It is the reproduction, with the tools of PSTricks, of the image 6, page 137 of the book ``\textit{Les phénomènes naturels}'' of the Library \textit{Pour la Science}, Berlin (1978). This image is accompanied by the following comment: \begin{quote}\itshape -<<~Ces moirés tournants apparaissent quand les lentilles placées sur une trame et observées avec une autre trame identique à la première. La grosse lentille(convergente) réduit la trame inférieure, tandis que la petite lentille (divergente) la grossit. En conséquence, les moirés obtenus ont des sens de rotation opposés. Une figure de moiré ondulée traduit la présence d'aberrations optiques dans la lentille.~>> +<<~Ces moirés tournants apparaissent quand les lentilles placées sur une trame et observées avec une autre trame identique à la première. La grosse lentille (convergente) réduit la trame inférieure, tandis que la petite lentille (divergente) la grossit. En conséquence, les moirés obtenus ont des sens de rotation opposés. Une figure de moiré ondulée traduit la présence d'aberrations optiques dans la lentille.~>> \end{quote} + \textbf{Animation:} Big lens: magnification of 1.2, small lens: magnification of 0.8 + \begin{center} -\psset{unit=0.5} \begin{animateinline}[controls,palindrome, - begin={\begin{pspicture}(-8.5,-8.5)(8.5,8.5)}, + begin={\begin{pspicture}(-7,-7)(7,7)}, end={\end{pspicture}}]{10}% 10 image/s \multiframe{20}{i=-10+1}{% \psset{LensHandle=false,LensShadow=false} -\psset{linecolor=red,linewidth=0.1,type=linear} +\psset{linecolor=red,linewidth=0.1,type=linear,n=60} \psmoire% \PstLens[LensMagnification=1.2,LensSize=2](1,1.5){\psmoire} \PstLens[LensMagnification=0.8,LensSize=1.5](-2,-2){\psmoire} @@ -552,13 +1188,12 @@ These rotating moirés were obtained with the use of the \texttt{pst-lens} packa \end{animateinline} \end{center} {\tiny\begin{verbatim} -\psset{unit=0.5} \begin{animateinline}[controls,palindrome, - begin={\begin{pspicture}(-8.5,-8.5)(8.5,8.5)}, + begin={\begin{pspicture}(-7,-7)(7,7)}, end={\end{pspicture}}]{10}% 10 image/s \multiframe{20}{i=-10+1}{% \psset{LensHandle=false,LensShadow=false} -\psset{linecolor=red,linewidth=0.1,type=linear} +\psset{linecolor=red,linewidth=0.1,type=linear,n=60} \psmoire% \PstLens[LensMagnification=1.2,LensSize=2](1,1.5){\psmoire} \PstLens[LensMagnification=0.8,LensSize=1.5](-2,-2){\psmoire} @@ -570,6 +1205,521 @@ These rotating moirés were obtained with the use of the \texttt{pst-lens} packa \newpage +\section{Random moirés} + +\subsection{The command \Lcs{psRandom} (from \texttt{pstricks-add})} + +See the impressing examples of Emin Gabrielyan: +\begin{center} +\url{https://docs.switzernet.com/people/emin-gabrielyan/070212-random-moire} +\end{center} +Here we present his first example the PSTricks way and some other random moirés as well---the package \texttt{pstricks-add} is required however: + +\bigskip + +\textbf{Example 1: Concentric circles} + +\begin{minipage}[t]{9cm}\kern0pt +\begin{pspicture}(-4.5,-4.5)(4.5,4.5) +\def\myWidth{1pt} +\def\myPattern{% +\psRandom[% +randInit=42, +dotstyle=o, +fillstyle=solid, +fillcolor=red, +linecolor=red, +randomPoints=4200, +dotsize=\myWidth +](-4,-4)(4,4){\psframe(-4,-4)(4,4)} +} +\rput{0}(0,0){\myPattern} +\rput{4}(0,0){\myPattern} +\end{pspicture} +\end{minipage} +\hfill +\begin{minipage}[t]{7.5cm}\kern0pt +{\small\begin{verbatim} +\begin{pspicture}(-4.5,-4.5)(4.5,4.5) +\def\myWidth{1pt} +\psRandom[% +randInit=42, +dotstyle=o, +fillstyle=solid, +fillcolor=red, +linecolor=red, +randomPoints=4200, +dotsize=\myWidth +](-4,-4)(4,4){\psframe(-4,-4)(4,4)} +} +\rput{0}(0,0){\myPattern} +\rput{4}(0,0){\myPattern} +\end{pspicture} +\end{verbatim}} +\end{minipage} + +\bigskip + +\textbf{Example 2: Spiral} + +\begin{minipage}[t]{9cm}\kern0pt +\begin{pspicture}(-4.5,-4.5)(4.5,4.5) +\def\myWidth{1pt} +\def\myPattern{% +\psRandom[% +randInit=42, +dotstyle=o, +fillstyle=solid, +fillcolor=blue, +linecolor=blue, +randomPoints=4200, +dotsize=\myWidth +](-4,-4)(4,4){\psframe(-4,-4)(4,4)} +} +\rput{0}(0,0){\myPattern} +\rput{4}(0,0){\psset{xunit=1.05,yunit=1.05}\myPattern} +\end{pspicture} +\end{minipage} +\hfill +\begin{minipage}[t]{7.5cm}\kern0pt +{\small\begin{verbatim} +\begin{pspicture}(-4.5,-4.5)(4.5,4.5) +\def\myWidth{1pt} +\def\myPattern{% +\psRandom[% +randInit=42, +dotstyle=o, +fillstyle=solid, +fillcolor=blue, +linecolor=blue, +randomPoints=4200, +dotsize=\myWidth +](-4,-4)(4,4){\psframe(-4,-4)(4,4)} +} +\rput{0}(0,0){\myPattern} +\rput{4}(0,0){% +\psset{xunit=1.05,yunit=1.05} +\myPattern} +\end{pspicture +} +\end{verbatim}} +\end{minipage} + + +\newpage + + +\textbf{Example 3: Radial} + +\begin{minipage}[t]{9cm}\kern0pt +\begin{pspicture}(-4.5,-4.5)(4.5,4.5) +\def\myWidth{1pt} +\def\myPattern{% +\psRandom[% +randInit=42, +dotstyle=o, +fillstyle=solid, +fillcolor=green, +linecolor=green, +randomPoints=4200, +dotsize=\myWidth +](-4,-4)(4,4){\psframe(-4,-4)(4,4)} +} +\rput{0}(0,0){\myPattern} +\rput{0}(0,0){\psset{xunit=1.05,yunit=1.05}\myPattern} +\end{pspicture} +\end{minipage} +\hfill +\begin{minipage}[t]{7.5cm}\kern0pt +{\small\begin{verbatim} +\begin{pspicture}(-4.5,-4.5)(4.5,4.5) +\def\myWidth{1pt} +\def\myPattern{% +\psRandom[% +randInit=42, +dotstyle=o, +fillstyle=solid, +fillcolor=green, +linecolor=green, +randomPoints=4200, +dotsize=\myWidth +](-4,-4)(4,4){\psframe(-4,-4)(4,4)} +} +\rput{0}(0,0){\myPattern} +\rput{0}(0,0){% +\psset{xunit=1.05,yunit=1.05} +\myPattern +} +\end{pspicture} +\end{verbatim}} +\end{minipage} + +\bigskip + +\textbf{Example 4: Hyperbolic} + +\begin{minipage}[t]{9cm}\kern0pt +\begin{pspicture}(-4.5,-4.5)(4.5,4.5) +\def\myWidth{1pt} +\def\myPattern{% +\psRandom[% +randInit=42, +dotstyle=o, +fillstyle=solid, +fillcolor=brown, +linecolor=brown, +randomPoints=4200, +dotsize=\myWidth +](-4,-4)(4,4){\psframe(-4,-4)(4,4)} +} +\rput{0}(0,0){\psset{xunit=0.95,yunit=1.05}\myPattern} +\rput{0}(0,0){\myPattern} +\end{pspicture} +\end{minipage} +\hfill +\begin{minipage}[t]{7.5cm}\kern0pt +{\small\begin{verbatim} +\begin{pspicture}(-4.5,-4.5)(4.5,4.5) +\def\myWidth{1pt} +\def\myPattern{% +\psRandom[% +randInit=42, +dotstyle=o, +fillstyle=solid, +fillcolor=brwon, +linecolor=brown, +randomPoints=4200, +dotsize=\myWidth +](-4,-4)(4,4){\psframe(-4,-4)(4,4)} +} +\rput{0}(0,0){% +\psset{xunit=0.95,yunit=1.05} +\myPattern +} +\rput{0}(0,0){\myPattern} +\end{pspicture} +\end{verbatim}} +\end{minipage} + +\bigskip + +\textbf{Remark:} For some more explanations of the so-called \emph{Glass patterns}, see: +\begin{center} +\url{http://www.scholarpedia.org/article/Glass_patterns} +\end{center} + + +\newpage + + +\subsection{The command \Lcs{psRandomDot}} + +Emin Gabrielyan presents on +\begin{center} +\url{https://docs.switzernet.com/people/emin-gabrielyan/070212-random-moire/} +\end{center} +another amazing moiré pattern (his second example). + +A plate perforated with holes (the \emph{revealing layer}), is placed on top of a fixed layer (the \emph{base layer}) filled with the digit ``2'', and then rotated. + +These holes of the revealing layer are arranged randomly, and the digits ``2'' are arranged on the base layer at exactly the same places (just larger than the holes and rotated by -90 degrees). Both layers are therefore correlated---this is the necessary condition for the existence of this random moiré phenomenon. + +Why do we see the digit ``2'' as a \emph{halo} with a magnifying effect as a function of the angle---upright or upside down according to the sign of the angle? The holes of the revealing layer cover the digits ``2'' of the base layer and these superposed parts reconstruct an enlarged digit ``2''; what is the explanation of this phenomenon? + + +\bigskip + +\begin{BDef} +\Lcs{psRandomDot}\OptArgs\Largr{x , y} +\end{BDef} + +The command \Lcs{psRandomDot} contains the options \nxLkeyword{hole=}, \nxLkeyword{r=}, \nxLkeyword{p=}, \nxLkeyword{k=}, \nxLkeyword{symbole=}, \nxLkeyword{rotate=}, \nxLkeyword{PSfont=}, \nxLkeyword{fontsize=}, \nxLkeyword{vadjust=} and \nxLkeyword{hadjust=}. + +The optional argument \Largr{x , y} sets up the dimensions \texttt{x} and \texttt{y} of the image. If not chosen $(10,10)$ is taken by default. + +\medskip + +\begin{quote} +\begin{tabularx}{\linewidth}{ @{} l >{\ttfamily}l X @{} }\toprule +\textbf{Name} & \textbf{Default} & \textbf{Meaning}\\\midrule +\Lkeyword{hole} & round & Types of holes: hole=round (circle holes), hole=square (square holes)\\ +%% +\Lkeyword{r} & 0.5 & Radius for circle/side length of square of the holes (in pt)\\ +%% +\Lkeyword{p} & 4 & Distance between the holes (in pt).\\ +%% +\Lkeyword{rotate} & 0 & Angle of rotation between base layer and revealing layer (in degrees) \\ +& & Typical values: -2<rotate<2\\ +%% +\Lkeyword{k} & 0.2 & Factor for the dispersion of the holes\\ +%% +\Lkeyword{symbole} & 2 & Digit or letter for the base layer\\ +%% +\Lkeyword{PSfont} & Helvetica-Bold & Font family of PS fonts\\ +%% +\Lkeyword{fontsize} & 4.7 & Font size (in pt)\\ +%% +\Lkeyword{vadjust} & -1.5 & Vertical adjustment of the superposed image\\ +%% +\Lkeyword{hadjust} & 0 & Horizontal adjustment of the superposed image\\ +\bottomrule +\end{tabularx} +\end{quote} + +\textbf{Principle:} + +\begin{enumerate} +\item We draw a path (newpath) that starts along a square (or a rectangle) anti-clockwise. +\item On a 2D grid, where points are setup with a constant distance of \texttt{p}, the centers of the circle/square shaped holes (with dimensions \texttt{r}) are then randomly distributed around each of the points on the grid within a circle with the \emph{distribution radius} $\rho = k\cdot p$. (The bigger \texttt{k}, the more disorder. The bigger \texttt{p}, the less points inside the given grid of a square/rectangle base layer.) +\end{enumerate} + +\textbf{Additional Remark:} For a list of some more \emph{PostScript font names}, look up the appendix on page~\pageref{sec:PSF}. + + +\newpage + + +\textbf{Example 1:} + +\begin{minipage}[t]{11cm}\kern0pt +\begin{pspicture}(-5,-5.5)(5,5) +\psRandomDot[ +r=0.5, +p=4, +k=0.2, +symbole=2, +rotate=-1, +PSfont=Helvetica-Bold, +fontsize=4.7, +vadjust=-1.5, +hadjust=0, +hole=round](10,10) +\end{pspicture} +\end{minipage} +\hfill +\begin{minipage}[t]{5cm}\kern0pt +{\small\begin{verbatim} +\begin{pspicture}(-5,-5.5)(5,5) +\psRandomDot[ +r=0.5, +p=4, +k=0.2, +symbole=2, +rotate=-1, +PSfont=Helvetica-Bold, +fontsize=4.7, +vadjust=-1.5, +hadjust=0, +hole=round](10,10) +\end{pspicture} +\end{verbatim}} +\end{minipage} + +\textbf{Example 2:} + +\begin{minipage}[t]{11cm}\kern0pt +\begin{pspicture}(-5,-5.5)(5,5) +\psRandomDot[ +r=0.5, +p=4, +k=0.2, +symbole=p, +rotate=-1, +PSfont=Symbol, +fontsize=4.7, +vadjust=-1.5, +hadjust=0, +hole=round](10,10) +\end{pspicture} +\end{minipage} +\hfill +\begin{minipage}[t]{5cm}\kern0pt +{\small\begin{verbatim} +\begin{pspicture}(-5,-5.5)(5,5) +\psRandomDot[ +r=0.5, +p=4, +k=0.2, +symbole=p, +rotate=-1, +PSfont=Symbol, +fontsize=4.7, +vadjust=-1.5, +hadjust=0, +hole=round](10,10) +\end{pspicture} +\end{verbatim}} +\end{minipage} + + +\newpage + + +\section{Glass-patterns} + +\emph{Glass-patterns} result from a superposition of two random dotted layers---a first original layer and a second layer which is a transformed layer of the original. + +These patterns received their names from Leon Glass. + + +\subsection{The command \Lcs{psGlassPattern}} + +\begin{BDef} +\Lcs{psGlassPattern}\OptArgs +\end{BDef} + +The command \Lcs{psGlassPattern} contains the options \nxLkeyword{function=} and \nxLkeyword{layer=true/false}. + +\medskip + +\begin{quote} +\begin{tabularx}{\linewidth}{ @{} l >{\ttfamily}l X @{} }\toprule +\textbf{Name} & \textbf{Default} & \textbf{Meaning}\\\midrule +\Lkeyword{function} & 5 r mul t 5 mul sin neg & The equation of the function\\ + & 0.5 mul 1 add mul 2.5 sub & \\ + && \texttt{r} and \texttt{t} are the variables of the function in polar coordinates\\ + && \verb-r=sqrt(x^2+y^2)-, \verb+t=theta+\\ +%% +\Lkeyword{layer} & true & Both layers are shown. If set to \texttt{false}, only the layer with the hidden shape of the function is shown.\\ +\bottomrule +\end{tabularx} +\end{quote} + +\textbf{Note:} The dimensions of the layers are 15 cm x 15 cm and can be modified with \texttt{unit=}. + +\bigskip + +\textbf{Remarks:} +\begin{itemize} +\item The key \texttt{function=} is the equation of a function in polar coordinates with the variables \texttt{r} (radius coordinate) and \texttt{t}, which is an angle in degrees. + + The star-like functions are of the type: \texttt{z=r*(1-0.5*cos(theta))}, with each value of \texttt{z} there corresponds a star-like function with the equation (in polar coordinates): + + \texttt{r=z/(1-0.5*cos(theta))} + + The equation of a function can either be entered with RVN (Reverse Polish Notation = PostScript notation) or when the PSTricks key \texttt{algebraic=true} is set, it is possible to enter the equation in algebraic notation (therefore we need to transform the variable \texttt{t} from degrees into radians which can be done with the substitution \texttt{t -> t*Pi/180}. +\item If the key \texttt{layer=false} is set to false, only the layer with the hidden shape of the function is shown. +\item The colors of the randomly arranged dots can be chosen with the PSTricks keys \texttt{linecolor=} (for the first layer) and \texttt{fillcolor=} (for the second layer). +\item The size and shape of the dots can be setup with the PSTricks keys \texttt{dotsize=} and \texttt{dotstyle=}. +\end{itemize} + + +\newpage + + +\textbf{Example 1:} + +Here a citation from Isaac Amidror from his book: + +``The Theory of the Moiré Phenomenum'', Volume II: Aperiodic Layers, \textbf{3-18: Synthesis of a layer superposition having a predefined fixed locus.} + +\begin{quote}\itshape +``Design layer transformations $\mathbf{g}_1(x,y)$ and $\mathbf{g}_2(x,y)$ that will produce in the superposition of two initially identical random screens a fixed locus consisting of a star-like curve that surrounds the origin as shown in the figure on the front cover of this book. Hint: In this case, you may consider a top-opened conic surface having star-like level lines, such as $z=r(1+0.5\cos5\theta)$, or, possibly, $z=r/(1+0.5\cos5\theta)$, which gives a slightly different star. You may adjust the orientation of the star by replacing $\cos$ by $\sin$ or by $-\sin$, as seems suitable. In order to have this surface intersect the $x,y$ plane along a star, you need to lower it by some constant $z_0$: $z=r(1+0.5\cos5\theta)-z_0$. But if you wish to obtain a more complex surface that intersects the $x,y$ plane on a family of concentric stars, you may consider a surface such as: $z=\sin(r(1+0.5\cos5\theta))$.'' +\end{quote} + +\begin{center} +\begin{pspicture}(-7,-7)(7,7) +\psframe*[linecolor=orange](-7,-7)(7,7) +% z=5*r*(1-0.5*sin(5*t*Pi/180))-2.5 +\psGlassPattern[unit=0.8,linecolor=red] +\end{pspicture} +\end{center} +{\small\begin{verbatim} +\begin{pspicture}(-7,-7)(7,7) +\psframe*[linecolor=orange](-7,-7)(7,7) +% z=5*r*(1-0.5*sin(5*t*Pi/180))-2.5 +\psGlassPattern[unit=0.8,linecolor=red] +\end{pspicture} +\end{verbatim}} + + +\newpage + + +\textbf{Example 2:} + +\begin{minipage}[t]{11cm}\kern0pt +\begin{pspicture}(-5,-5)(5,5) +\psframe*[linecolor=red](-5,-5)(5,5) +% in algebraic notation +% t in degrees; +% arguments of sin and cos in radians +% convert t -> t*Pi/180 +\psGlassPattern[% +unit=0.65, +dotsize=1pt, +dotstyle=square, +linecolor={[rgb]{0 0 0.5}}, +algebraic, +function=5*r*(1-0.5*cos(7*t*Pi/180))-2.5] +\end{pspicture} +\end{minipage} +\hfill +\begin{minipage}[t]{6cm}\kern0pt +{\footnotesize\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psframe*[linecolor=red](-5,-5)(5,5) +% in algebraic notation +% t in degrees; +% arguments of sin and cos in radians +% convert t -> t*Pi/180 +\psGlassPattern[% +unit=0.65, +dotsize=1pt, +dotstyle=square, +linecolor={[rgb]{0 0 0.5}}, +algebraic, +function=5*r*(1-0.5*cos(7*t*Pi/180))-2.5] +\end{pspicture} +\end{verbatim}} +\end{minipage} + +\medskip + +\textbf{Example 3:} + +\begin{minipage}[t]{11cm}\kern0pt +\begin{pspicture}(-5,-5)(5,5) +\psframe*[linecolor=cyan](-5,-5)(5,5) +% in algebraic notation +% t in degrees; +% arguments of sin and cos in radians +% convert t -> t*Pi/180 +\psGlassPattern[% +unit=0.65, +dotsize=1pt, +dotstyle=square*, +linecolor=black, +fillcolor=cyan, +algebraic, +function=5*r/(1-0.75*sin(5*t*Pi/180))-2.5] +\end{pspicture} +\end{minipage} +\hfill +\begin{minipage}[t]{6cm}\kern0pt +{\footnotesize\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psframe*[linecolor=cyan](-5,-5)(5,5) +% in algebraic notation +% t in degrees; +% arguments of sin and cos in radians +% convert t -> t*Pi/180 +\psGlassPattern[% +unit=0.65, +dotsize=1pt, +dotstyle=square*, +linecolor=black, +fillcolor=cyan, +algebraic, +function=5*r/(1-0.75*sin(5*t*Pi/180))-2.5] +\end{pspicture} +\end{verbatim}} +\end{minipage} + + +\newpage + + \section{Animations} Some interactive moiré JavaScript based applications can be found on: @@ -577,6 +1727,11 @@ Some interactive moiré JavaScript based applications can be found on: \url{https://melusine.eu.org/syracuse/G/pstricks/pst-moire/moirej/} \end{center} +The following animations are all generated with the \texttt{animate} package of Alexander Grahn. +\begin{center} +\url{https://ctan.org/pkg/animate} +\end{center} + \textbf{Animation 1:} \begin{center} @@ -617,8 +1772,10 @@ Some interactive moiré JavaScript based applications can be found on: end={\end{pspicture}} ]{10}% 10 image/s \multiframe{36}{r=0+0.1}{% -\psmoire[scale=0.85,type=linear,rotate=-\r,linewidth=0.1,linecolor=red](0,0)% -\psmoire[scale=0.85,type=linear,rotate=\r,linewidth=0.1,linecolor=red](0,0)% +\psframe*[linecolor=black](-6,-6)(6,6) +\psmoire[type=linear,rotate=-\r,linewidth=0.05,linecolor=yellow,n=60](0,0)% +\psmoire[type=linear,rotate=\r,linewidth=0.15,linecolor=black,n=60](0,0)% +\psframe[linecolor=yellow,linewidth=5pt](-6,-6)(6,6) } \end{animateinline} \end{center} @@ -629,8 +1786,10 @@ Some interactive moiré JavaScript based applications can be found on: end={\end{pspicture}} ]{10}% 10 image/s \multiframe{36}{r=0+0.1}{% -\psmoire[scale=0.85,type=linear,rotate=-\r,linewidth=0.1,linecolor=red](0,0)% -\psmoire[scale=0.85,type=linear,rotate=\r,linewidth=0.1,linecolor=red](0,0)% +\psframe*[linecolor=black](-6,-6)(6,6) +\psmoire[type=linear,rotate=-\r,linewidth=0.05,linecolor=yellow,n=60](0,0)% +\psmoire[type=linear,rotate=\r,linewidth=0.15,linecolor=black,n=60](0,0)% +\psframe[linecolor=yellow,linewidth=5pt](-6,-6)(6,6) } \end{animateinline} \end{verbatim} @@ -657,6 +1816,10 @@ Some interactive moiré JavaScript based applications can be found on: \end{animateinline} \end{center} {\small\begin{verbatim} +\definecolor{moire1}{rgb}{0.98,0.89,0.56} +\definecolor{moire2}{rgb}{0.357,0.525,0.13} +\definecolor{moire3}{rgb}{0.2,0.05,0.015} +\definecolor{moire4}{rgb}{0.070.41 0.255} \begin{animateinline}[% controls,palindrome, begin={\begin{pspicture}(-6,-6)(6,6)}, @@ -713,7 +1876,7 @@ Some interactive moiré JavaScript based applications can be found on: \textbf{Animation 5:} -This idea came from a post card ``\textbf{turn the top part}'', bought in a boutique of the centre Beaubourg in Paris, showing the phenomenon of the moiré effect and redesigned with PSTricks. +The reason to finally setup this PSTricks package came from a post card ``\textit{turn the top part}''---bought years ago in a boutique of the \emph{Centre Beaubourg} in Paris---showing up this quite spectacular phenomenon of the \emph{moiré effect} and the following code was quickly ready made to redesign it within PSTricks. \begin{center} \def\myMoire{% @@ -813,9 +1976,9 @@ This idea came from a post card ``\textbf{turn the top part}'', bought in a bout \section{Theory---for the interested user}\label{sec:theory} -\subsection{The contribution of ``éditions Kangourou''} +\subsection{The contribution of ``\textit{éditions Kangourou}''} -``Le Kangourou des mathématiques'': \textcolor{orange}{\url{http://www.mathkang.org/}} published a revue in 2002, ``\textsl{Les malices du Kangourou}'' that contains a magnificent article from pages 18 to 26 titled ``\textsl{Mirifiques et mirobolants moirés}'' and on the back cover ``La règle à moirer'' (``The ruler''). The article and the ruler are available at the following addresses: +``\textit{Le Kangourou des mathématiques}'': \textcolor{orange}{\url{http://www.mathkang.org/}} published a revue in 2002, ``\textit{Les malices du Kangourou}'' that contains a magnificent article from pages 18 to 26 titled ``\textit{Mirifiques et mirobolants moirés}'' and on the back cover ``\textit{La règle à moirer}'' (``\textit{The ruler}''). The article and the ruler are available at the following addresses: \begin{center} \url{http://www.mathkang.org/cite/moires9p.pdf} \\ @@ -836,13 +1999,13 @@ In the article the sketches are very beautiful and the part ``\textit{Mathémati \newpage -\subsection{The contribution of Henri Bouasse} +\subsection{The contribution of Henri Bouasse}\label{sec:Bouasse} \newcounter{boua} \newcommand{\itemBoua}{\addtocounter{boua}{1}\strut\indent\textit{\theboua}\textsuperscript{o} --- } -This is the chapter of his book \textit{Vision et reproduction des formes et des couleurs} published at Librairie Delagrave in Paris in 1917. His demonstration and the diagram within his book have been reproduced here: +This is the chapter of his book ``\textit{Vision et reproduction des formes et des couleurs}'' published at Librairie Delagrave in Paris in 1917. His demonstration and the diagram within his book have been reproduced here: \medskip @@ -855,7 +2018,7 @@ This is the chapter of his book \textit{Vision et reproduction des formes et des Consider two straight lines respectively parallel: \begin{equation} x\cos\THETA +y\sin\THETA=bt+ct^2\quad\quad x\cos\THETA -y\sin\THETA=b\TAU-c\TAU^2 -\label{droites} +\label{eq:droites} \end{equation} \begin{figure}[h] \begin{center} @@ -914,7 +2077,7 @@ x\cos\THETA +y\sin\THETA=bt+ct^2\quad\quad x\cos\THETA -y\sin\THETA=b\TAU-c\TAU^ } \end{pspicture} \end{center} -\caption{\label{fig169} Moiré: parallel lines} +\caption{Moiré: parallel lines} \end{figure} \indent For $t=\TAU=0$, we get the two lines $\mathrm{OS_2}$ and $\mathrm{OS_1}$; they obviously have the same angle $\THETA$ with the axis $\mathrm{O}y$. @@ -922,7 +2085,7 @@ The curves of the intersection points, which correspond to the small diagonals o \begin{equation*} t-\TAU=\MU=\mathrm{constant} \end{equation*} -\indent Adding and reordering the equations~(\ref{fig169}): +\indent Adding and reordering the equations~(\ref{eq:droites}): \begin{align*} 2x\cos\THETA&=(b+c\MU)(t+\TAU)\\ 2y\sin\THETA&=b\MU+c(t^2+\TAU^2)=b\MU+c(\MU^2+2t\TAU) @@ -953,23 +2116,23 @@ The equation~(\ref{parabole}) becomes: \indent This is the same parabola for all the values of $\MU$ sliding parallely to O$y$. The vertices are given by: \begin{equation} y=\MU \frac{b}{2\sin\THETA} -\label{sommets2} +\label{eq:sommets2} \end{equation} The radius of curvature at the vertex of the parabola is: \begin{equation*} \mathrm{R}=\frac{b^2}{2c}\frac{\sin\THETA}{\cos^2\THETA} \end{equation*} -\indent If the parallel straight lines are equidistant $(c=0)$, the parabolas degenerate to straight lines~(\ref{sommets2}); in other words, the radius of curvature becomes infinite. +\indent If the parallel straight lines are equidistant $(c=0)$, the parabolas degenerate to straight lines~(\ref{eq:sommets2}); in other words, the radius of curvature becomes infinite. \\ -\itemBoua To make an experiment, we trace with ``China ink'' on a paper 51 parallel lines with a length of i. e. 20~cm, where the distance between two adjacent lines increases from 2~mm (between the first two lines) to 3~mm (between the last two lines), following the formula: +\itemBoua To make an experiment, we trace with ``\textit{China ink}'' on a paper 51 parallel lines with a length of i. e. 20~cm, where the distance between two adjacent lines increases from 2~mm (between the first two lines) to 3~mm (between the last two lines), following the formula: \begin{equation*} s=2t+0.01t^2 \end{equation*} \indent We take a photo by reducing to the half or a quarter. We generate two diapositives\footnote{spelling of the time.}. We realize the phenomenon when placing one over the other by rotating one of them. -We think that if you had followed the given instructions, you might be as well convinced---as we are---it would have been a pity to have left this beautiful demonstration ``of that time'' in oblivion! +We think that if you had followed the given instructions, you might be as well convinced---as we are---it would have been a pity to have left this beautiful demonstration ``\textit{of that time}'' in oblivion! \subsection{The humble contributions of our group} @@ -999,7 +2162,7 @@ This method is discussed on page 136 of the book ``\textit{Les phénomènes natu y=a\mathrm{e}^{-(kx)^2} \end{equation*} \begin{center} -\begin{pspicture}(-6,-1)(6,3.5) +\begin{pspicture}(-6,-0.5)(6,3.5) \psparametricplot[plotpoints=1000]{-6}{6}{% t 3 2.71828 -0.5 t dup mul mul exp mul @@ -1008,13 +2171,13 @@ y=a\mathrm{e}^{-(kx)^2} \end{center} -\subsubsection{Determination of the points of intersection} +\subsubsection{Determination of the points of intersection}\label{sec:Gauss} -The equidistant vertical line network has for equation: $x=ne$, $e$ is the spacing et $n$ an integer. +The equidistant vertical line network has for equation: $x=ne$, $e$ is the spacing and $n$ is an integer. -The ordinates of the intersection points are: $y_n=a\mathrm{e}^{-(kne)^2}$. Within the following figure, we set the spacing to 0.5. +The ordinates of the intersection points are: $y_n=a\mathrm{e}^{-(kne)^2}$. Within the following figure, we set the spacing between the points on the Gaussian curve with the key \texttt{E=0.5} (in cm). \begin{center} -\begin{pspicture}(-6,-1)(6,3.5) +\begin{pspicture}(-6,-0.5)(6,3.5) \parametricplot[plotpoints=1000]{-6}{6}{% t 3 2.71828 0.5 t mul dup mul neg exp mul @@ -1030,13 +2193,19 @@ The ordinates of the intersection points are: $y_n=a\mathrm{e}^{-(kne)^2}$. With \psdot(! \n\space E1 mul % x A1 2.71828 K1 \n\space E1 mul mul dup mul neg exp mul) } +\psline[linecolor=red]{|<->|}(! -11 E1 mul 0.5)(! -10 E1 mul 0.5) +\uput[90](! -10.5 E1 mul 0.5){\textcolor{red}{\texttt{E=0.5}}} +\psline[linecolor=red]{|<->|}(! -5 E1 mul 1.5)(! -4 E1 mul 1.5) +\uput[90](! -4.5 E1 mul 1.5){\textcolor{red}{\texttt{E=0.5}}} +\psline[linecolor=red]{|<->|}(! 5 E1 mul 1)(! 6 E1 mul 1) +\uput[90](! 5.5 E1 mul 1){\textcolor{red}{\texttt{E=0.5}}} \end{pspicture} \end{center} -\subsubsection{Drawing the network of the stright lines} +\subsubsection{Drawing the network of the straight lines} -We determine the equations of the straight lines passing through these points and which are inclined by an angle $\alpha$ with respect to the horizontal. +We determine the equations of the straight lines passing through these points and which are inclined by an angle $\alpha$ with respect to the horizontal. This is to setup with the key \texttt{Alpha=} (in degrees). The general equation of such a line is given by: $y=x\tan(\alpha)+b$, we determine $b$ to go through one of the previous points. \begin{equation*} @@ -1046,6 +2215,11 @@ so we get $b$. \begin{equation*} b=a\mathrm{e}^{-(kne)^2}-ne\tan(\alpha) \end{equation*} + + +\newpage + + For every value of $n$ we get a straight line. \begin{equation*} y=x\tan(\alpha)+a\mathrm{e}^{-(kne)^2}-ne\tan(\alpha) @@ -1095,7 +2269,7 @@ The last step is to translate these lines into PostScript code. \subsection{Some moiré figures} -\subsubsection{Circles + Circles} +\subsubsection{\texttt{type=circle + type=circle}} \begin{center} \psscalebox{0.6}{% @@ -1177,10 +2351,9 @@ b^2=a^2-c^2 \] -\subsubsection{Squares + Fresnel rings} +\subsubsection{\texttt{type=square + type=Fresnel}} \begin{center} -%\psset{scale=0.5,Rmax=7.5} \psscalebox{0.6}{% \begin{pspicture}(-6,-6)(6,6) \psmoire[type=square] @@ -1226,7 +2399,7 @@ On a curve of moiré, we verify: $p-q=m\in\mathbb{Z}$: This family of moiré curves are circles with the center at $(\frac{1}{2a},0)$ and with a radius of $r_m=\sqrt{m+\frac{1}{4a^2}}$ -\subsubsection{Circle + Squares of Newton} +\subsubsection{\texttt{type=circle + type=Newton}} \begin{center} %\psset{scale=0.5,Rmax=7.5} @@ -1312,8 +2485,7 @@ In polar coordinates: \end{minipage} - -\subsubsection{Circles + Fresnel rings} +\subsubsection{\texttt{type=circle + type=Fresnel}} \begin{center} %\psset{scale=0.5} @@ -1363,7 +2535,7 @@ One moiré curve line is determined by: $p-q=m\in\mathbb{Z}$, thus: which is the implicit equation of a moiré curve line with $m$. -\subsubsection{Circles + Squares (both of increasing thickness)} +\subsubsection{Circles and Squares (both of increasing thickness)} \begin{center} \psscalebox{0.6}{% @@ -1486,4 +2658,75 @@ We can trace some elements of this family of curves:\label{sec:theoryEnd} \egroup \printindex + + +\newpage + + +\begin{appendix} +\section{PostScript Font Names}\label{sec:PSF} + +\begin{minipage}[t]{0.45\linewidth}\kern0pt +\subsubsection*{Ghostscript} + +\begin{tabular}{ll} +uagd8a & URWGothicL-Demi \\ +uagdo8a & URWGothicL-DemiObli \\ +uagk8a & URWGothicL-Book \\ +uagko8a & URWGothicL-BookObli \\ +ubkd8a & URWBookmanL-DemiBold \\ +ubkdi8a & URWBookmanL-DemiBoldItal \\ +ubkl8a & URWBookmanL-Ligh \\ +ubkli8a & URWBookmanL-LighItal \\ +ucrb8a & NimbusMonL-Bold \\ +ucrbo8a & NimbusMonL-BoldObli \\ +ucrr8a & NimbusMonL-Regu \\ +ucrro8a & NimbusMonL-ReguObli \\ +uhvb8a & NimbusSanL-Bold \\ +uhvb8ac & NimbusSanL-BoldCond \\ +uhvbo8a & NimbusSanL-BoldItal \\ +uhvbo8ac & NimbusSanL-BoldCondItal \\ +uhvr8a & NimbusSanL-Regu \\ +uhvr8ac & NimbusSanL-ReguCond \\ +uhvro8a & NimbusSanL-ReguItal \\ +uhvro8ac & NimbusSanL-ReguCondItal \\ +uncb8a & CenturySchL-Bold \\ +uncbi8a & CenturySchL-BoldItal \\ +uncr8a & CenturySchL-Roma \\ +uncri8a & CenturySchL-Ital \\ +uplb8a & URWPalladioL-Bold \\ +uplbi8a & URWPalladioL-BoldItal \\ +uplr8a & URWPalladioL-Roma \\ +uplri8a & URWPalladioL-Ital \\ +usyr & StandardSymL \\ +utmb8a & NimbusRomNo9L-Medi \\ +utmbi8a & NimbusRomNo9L-MediItal \\ +utmr8a & NimbusRomNo9L-Regu \\ +utmri8a & NimbusRomNo9L-ReguItal \\ +uzcmi8a & URWChanceryL-MediItal \\ +uzdr & Dingbats +\end{tabular} +\end{minipage} +\hfill +\begin{minipage}[t]{0.45\linewidth}\kern0pt +\subsubsection*{Adobe Basic 14} + +\begin{tabular}{ll} +Times & Times-Roman \\ + & Times-Italic \\ + & Times-Bold \\ + & Times-BoldItalic \\ +Helvetica & Helvetica \\ + & Helvetica-Oblique \\ + & Helvetica-Bold \\ + & Helvetica-BoldOblique \\ +Courier & Courier \\ + & Courier-Oblique \\ + & Courier-Bold \\ + & Courier-BoldOblique \\ +ZapfDingbats & ZapfDingbats \\ +Symbol & Symbol +\end{tabular} +\end{minipage} +\end{appendix} \end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/generic/pst-moire/pst-sin.pro b/Master/texmf-dist/doc/generic/pst-moire/pst-sin.pro new file mode 100644 index 00000000000..f3f9e82302b --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-moire/pst-sin.pro @@ -0,0 +1,26 @@ +moireDict begin +/pst-sin { +0 0 translate +2 dict begin +/A1 0.5 def % amplitude +/TRAME { +-50 E1 2 mul 50 {/n exch def +gsave + n E1 mul unit % x + A1 unit 360 Tr div n E1 mul mul sin mul % y + translate + linecolor + linewidth + -6 unit -6 m mul unit moveto + 6 unit 6 m mul unit lineto + stroke +grestore + } for +} def +Runit neg dup +Runit 2 mul dup +rectclip + TRAME +end +} def +end diff --git a/Master/texmf-dist/dvips/pst-moire/pst-moire.pro b/Master/texmf-dist/dvips/pst-moire/pst-moire.pro index 59fd37da5e6..38996bf0ed9 100644 --- a/Master/texmf-dist/dvips/pst-moire/pst-moire.pro +++ b/Master/texmf-dist/dvips/pst-moire/pst-moire.pro @@ -68,21 +68,23 @@ grestore } def % /pst-linear { -Runit neg 0 translate /trait { newpath 0 Runit neg moveto 0 Runit lineto linecolor linewidth +% Tr 2 div setlinewidth stroke } def gsave -0 1 NombreTraits 1 add{% 50 traits espacés de 2 mm - trait - mm 2 mul 0 translate - } for +Runit neg 0 translate + trait + nr { + Tr 0 translate + trait +} repeat grestore } def % @@ -133,21 +135,17 @@ grestore }def % /pst-circle { -/Circle { - newpath - 0 0 Radius 0 360 arc - closepath + gsave +/rad 1 mm mul def +1 1 nr {/rad exch def + /radius rad Tr mul def + circle linecolor linewidth stroke - }def - gsave -0 1 NombreTraits 2 div {% 50 carrés espacés de 2 mm - /Radius exch mm 2 mul mul def - Circle } for grestore -} def +} def % /pst-Bouasse{ /grille { @@ -171,40 +169,11 @@ reduc reduc scale grestore } def % -/pst-Gauss1{% definition obsolete -10 dict begin -/a 0.5 def -/yStart -10 def -/yStop 10 def -/TRAME { --15 0.5 15 { % le nombre de traits - /k exch def - /p 2.71828 0.5 k a mul dup mul mul neg exp m k a mul mul sub def - /xStart 10 neg p sub m div def - /xStop 10 p sub m div def - linecolor - linewidth - newpath - xStart unit yStart unit moveto - xStop unit yStop unit lineto - stroke -} for -} def -/CIRCLE {0 0 Runit 0 360 arc } def -gsave -CIRCLE clip - 90 Alpha sub rotate - TRAME -grestore -end -} def -% /pst-Gauss { 0 0 translate 10 dict begin /A1 3 def /K1 0.5 def -%/E1 0.25 def /TRAME { -40 E1 2 mul 40 {/n exch def gsave @@ -219,12 +188,9 @@ gsave grestore } for } def -Runit neg Runit neg moveto -Runit neg Runit lineto -Runit Runit lineto -Runit Runit neg lineto -Runit neg Runit neg lineto -clip +Runit neg dup +Runit 2 mul dup +rectclip TRAME end } def diff --git a/Master/texmf-dist/tex/generic/pst-moire/pst-moire.tex b/Master/texmf-dist/tex/generic/pst-moire/pst-moire.tex index 452f616976e..0962bd35cf2 100644 --- a/Master/texmf-dist/tex/generic/pst-moire/pst-moire.tex +++ b/Master/texmf-dist/tex/generic/pst-moire/pst-moire.tex @@ -20,8 +20,8 @@ %% `pst-moire' is a PSTricks package to draw moire patterns %% %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\def\fileversion{1.0}% -\def\filedate{2018/10/28}% +\def\fileversion{2.0}% +\def\filedate{2018/11/16}% \message{`PST-MOIRE v\fileversion, \filedate\space (ML)}% \csname PSTMoireLoaded\endcsname % Requires PSTricks, pst-xkey and pst-node packages @@ -34,27 +34,42 @@ \pstheader{pst-moire.pro} % \pst@addfams{pst-moire} -\define@key[psset]{pst-moire}{Rmax}{\edef\psk@moirage@R{#1}} % en cm -\define@key[psset]{pst-moire}{scale}{\edef\psk@moirage@scale{#1}} % echelle -\define@key[psset]{pst-moire}{Alpha}{\edef\psk@moirage@Alpha{#1}} % pente des traits pour Gauss en degrés -\define@key[psset]{pst-moire}{rotate}{\edef\psk@moirage@rot{#1 }} % rotation de la grille -\define@key[psset]{pst-moire}{E}{\edef\psk@moirage@E{#1 }} % espacement entre 2 traits de Gauss +\define@key[psset]{pst-moire}{Rmax}{\edef\psk@moire@R{#1}} % en cm +\define@key[psset]{pst-moire}{scale}{\edef\psk@moire@scale{#1}} % echelle +\define@key[psset]{pst-moire}{Alpha}{\edef\psk@moire@Alpha{#1}} % pente des traits pour Gauss en degrés +\define@key[psset]{pst-moire}{rotate}{\edef\psk@moire@rot{#1 }} % rotation de la grille +\define@key[psset]{pst-moire}{E}{\edef\psk@moire@E{#1 }} % espacement entre 2 traits de Gauss +\define@key[psset]{pst-moire}{n}{\edef\psk@moire@n{#1 }} % nombre de cercles +\define@key[psset]{pst-moire}{T}{\edef\psk@moire@T{#1 }} % période : dr en mm +% random-dots parameters +\define@key[psset]{pst-moire}{r}{\edef\psk@moire@r{#1 }} % r des trous en pts +\define@key[psset]{pst-moire}{p}{\edef\psk@moire@p{#1 }} % pas de la grille +\define@key[psset]{pst-moire}{k}{\edef\psk@moire@k{#1 }} % k : facteur qui module la dispersion des trous +\define@key[psset]{pst-moire}{symbole}{\def\psk@moire@symbol{#1}} % motif (lettre ou chiffre) +\define@key[psset]{pst-moire}{PSfont}{\def\pst@moirage@PSfont{/#1 }} +\define@key[psset]{pst-moire}{fontsize}{\def\pst@moirage@fontsize{#1 }} +\define@key[psset]{pst-moire}{vadjust}{\def\pst@moirage@vadjust{#1 }} +\define@key[psset]{pst-moire}{hadjust}{\def\pst@moirage@hadjust{#1 }} +\define@key[psset]{pst-moire}{hole}{\def\pst@moirage@hole{#1}} % -\psset{Rmax=6,scale=1,Alpha=70,rotate=0,E=0.25} +\psset[pst-moire]{Rmax=6,scale=1,Alpha=70,rotate=0,E=0.25,n=30,T=2} +\psset[pst-moire]{r=0.5,p=4,k=0.2,symbole=2,rotate=-1,PSfont=Helvetica-Bold,fontsize=4.7,vadjust=-1.5,hadjust=0,hole=round} % \def\variablesMoirages{% - /R \psk@moirage@R\space def - /reduction {\psk@moirage@scale\space mul} def + /R \psk@moire@R\space def + /reduction {\psk@moire@scale\space mul} def /unit {\pst@number\psunit mul reduction} def /moire {\psk@moire@type} def - /rot \psk@moirage@rot def + /rot \psk@moire@rot def /Runit R unit def - /E1 \psk@moirage@E def + /E1 \psk@moire@E def + /nr \psk@moire@n def + /Tr \psk@moire@T \pst@number\psunit 10 div mul def /circle { newpath 0 0 radius 0 360 arc closepath} def /NombreTraits Runit \pst@number\psrunit div 10 mul cvi def /NombreTraitsLinear Runit 2.845 div cvi def - /reduc \psk@moirage@scale\space def - /Alpha \psk@moirage@Alpha\space def + /reduc \psk@moire@scale\space def + /Alpha \psk@moire@Alpha\space def /m Alpha dup sin exch cos div def % tan(Alpha) /linecolor {\pst@usecolor\pslinecolor} def /linewidth {\pst@number\pslinewidth SLW} def @@ -71,7 +86,7 @@ \@for \name:=\@tempa\do{% \expandafter\def\csname pst@moire@#1@\name\endcsname{}% }} -% nature de l'anamorphose +% nature du moiré \def\pst@moire@list@type{% circle,Fresnel,radial,square,Gauss,Newton,Bouasse,linear,dot,chess} % @@ -84,9 +99,21 @@ \@pstrickserr{The moire #1 is not defined, the moire by default is drawn}{}% \fi} -% anamorphose par defaut +% moiré par defaut \psset[pst-moire]{type=Fresnel}% % +% 01 novembre 2018 +%% Ajout de moiré à la liste des types +\def\addtomoirelisttype#1{% +% ajouter les nouveaux objets la liste +\expandafter\def\expandafter\pst@moire@list@type\expandafter% + {\pst@moire@list@type,#1}% +% Reserver le nom des nouveaux types + \edef\@tempa{#1}% + \@for \name:=\@tempa\do{% + \expandafter\def\csname pst@moire@type@\name\endcsname{}% + }} +% \def\psmoire{\def\pst@par{}\pst@object{psmoire}} \def\psmoire@i{\@ifnextchar({\psmoire@do}{\psmoire@do(0,0)}} \def\psmoire@do(#1){% @@ -104,8 +131,221 @@ }% \end@SpecialObj% \endgroup% +}% +% +\def\psRandomDot{\def\pst@par{}\pst@object{psRandomDot}} +\def\psRandomDot@i{\@ifnextchar({\psRandomDot@ii}{\psRandomDot@ii(10,10)}} +\def\psRandomDot@ii(#1,#2){% +\begin@SpecialObj +\addto@pscode{% +/cm {\pst@number\psunit mul } bind def +/pagewidth #1 cm def % en cm +/pageheight #2 cm def % en cm +% pas de la grille +/gridwidth \psk@moire@p def +% rayon des trous +/holeradius \psk@moire@r def +/symbol (\psk@moire@symbol) def +/alpha \psk@moire@rot def +/PSfont {\pst@moirage@PSfont} def +/fontsize \pst@moirage@fontsize def +/vadjust \pst@moirage@vadjust def +/hadjust \pst@moirage@hadjust def +/hole (\pst@moirage@hole) def +PSfont findfont fontsize scalefont setfont +% nombre aléatoire compris entre 0.0000 et 1.0000 +/rand01 {rand 10000 mod 10000 div} def +% holedispersion permet de choisir le rayon du disque où on placera aléatoirement le centre du trou +/holedispersion {gridwidth \psk@moire@k neg \psk@moire@k 2 mul rand01 mul add mul} def +/loy pageheight -2 div def +/hiy pageheight 2 div def +/hix pagewidth 2 div def +/lox pagewidth -2 div def +/squarehole { + xi holeradius neg add + yi holeradius neg add moveto + 0 holeradius 2 mul rlineto + holeradius 2 mul 0 rlineto + 0 holeradius 2 mul neg rlineto } -\catcode`\@=\PstAtCode\relax +def +% +/revealer { +2 srand + newpath + lox gridwidth sub loy gridwidth sub moveto + pagewidth 2 gridwidth mul add 0 rlineto + 0 pageheight 2 gridwidth mul add rlineto + pagewidth neg 2 gridwidth mul sub 0 rlineto +loy gridwidth hiy + { + /y exch def +lox gridwidth hix + { + /x exch def + /xi x holedispersion add def + /yi y holedispersion add def +hole (round) eq { + xi holeradius add yi moveto + xi yi holeradius 360 0 arcn + }{ + squarehole + } ifelse + } + for + } + for + closepath + fill +} def +symbol stringwidth /wy exch def /wx exch def +/baselayer +{ +1 setgray +lox gridwidth sub loy gridwidth sub pagewidth 2 gridwidth mul add pageheight 2 gridwidth mul add rectstroke +% 0 setgray +\pst@usecolor\pslinecolor +2 srand +loy gridwidth hiy + { + /y exch def +lox gridwidth hix + { + /x exch def + /xi x holedispersion add def + /yi y holedispersion add def + gsave + xi yi moveto + wx -2 div hadjust add wy -2 div vadjust add rmoveto + symbol show + grestore + } + for + } + for +} def +-90 rotate +baselayer +alpha rotate +revealer + }% fin du code ps + \end@SpecialObj + }% % fin de la commande PSTricks +% https://lspwww.epfl.ch/publications/books/moire/figs1II.html +% +% Figure "star1" from the Moire Demonstration Kit accompanying the book: +% "The Theory of the Moire Phenomenon" +% by I. Amidror, published by Springer, 2007. +% +% * * * Copyright (c) 2007 EPFL * * * +% +% Author: I. Amidror +% +% Modified: March 30, 2007 +% +% ******************************************************************************** +% +% An aperiodic dot screen that has undergone a non-linear transformation +% +% ******************************************************************************** +% adapted by Manuel Luque for PSTricks +% November 15, 2018 +% +\define@key[psset]{pst-moire}{function}{\edef\psk@moire@function{#1 }} % la fonction +\define@boolkey[psset]{pst-moire}[Pst@moire@]{layers}[true]{} +% Default values +\psset[pst-moire]{function=5 r mul t 5 mul sin neg 0.5 mul 1 add mul 2.5 sub,layers=true} +% +\def\psGlassPattern{\def\pst@par{}\pst@object{psGlassPattern}} +\def\psGlassPattern@i{% +\addbefore@par{dotsize=1pt,fillcolor=black} +\begin@SpecialObj +\addto@pscode{% + \ifPst@algebraic + /fonction (\psk@moire@function) tx@AlgToPs begin AlgToPs end cvx def + \else + /fonction { \psk@moire@function } def + \fi + \psk@dotsize + \@nameuse{psds@\psk@dotstyle} + /dotcolor {\pst@usecolor\pslinecolor } def + /dotcolor2 {\pst@usecolor\psfillcolor} def +\ifPst@moire@layers /layers true def \else /layers false def \fi +/star-shapped { +20 dict begin +/Atan { /atan load stopped { pop pop 0 } if } def % return 0 if atan not known +/cm {\pst@number\psunit mul} bind def +/dim 15 cm def +/dim2 7.5 cm def +/myrand {rand 2147483647 div 2 mul 1 sub} def % random number between -1...1 +/pr 2 def % period for dot screen +% ************ Draw the dot-screen: +% draw first (reference) dot screen: +10 srand % seed for rand +/y dim2 neg def +1 setgray +-7.5 cm -7.5 cm 15 cm 15 cm rectfill +%0 setgray +%-7.5 cm -7.5 cm 15 cm 15 cm rectstroke +gsave +-7.5 cm -7.5 cm 14.75 cm 14.75 cm rectclip +dotcolor +0 pr dim % draw horizontal lines of dots +{ + /x dim2 neg def + /ysave exch dim2 sub def + 0 pr dim % draw a horizontal line of dots + {/xsave exch dim2 sub def + /x1 x dim2 div def + /y1 y dim2 div def + /r2 x1 x1 mul y1 y1 mul add def + /r r2 sqrt def + /t y1 x1 Atan def % angle in degrees! + /cost fonction def + xsave + fonction t cos mul % g1(x,y) + add + myrand sub + ysave + fonction t sin mul % g2(x,y) + add + myrand sub Dot + /x x pr add def + } for + /y y pr add def +} for +grestore +layers { +gsave +-7.25 cm -7.25 cm 14.75 cm 14.75 cm rectclip +% draw second dot screen: +%0 setgray +dotcolor2 +10 srand % same seed for rand +/y dim2 neg def +0 pr dim % draw horizontal lines of dots +{ + /x dim2 neg def + /ysave exch dim2 sub def + 0 pr dim + {/xsave exch dim2 sub def + xsave + myrand sub + ysave + myrand sub Dot + /x x pr add def + } for + /y y pr add def +} for +grestore +} if +end + } def +star-shapped + }% fin du code ps + \end@SpecialObj + }% % fin de la commande PSTricks + \catcode`\@=\PstAtCode\relax %% END: pst-moire.tex \endinput diff --git a/Master/texmf-dist/tex/latex/pst-moire/pst-moire.sty b/Master/texmf-dist/tex/latex/pst-moire/pst-moire.sty index e61db1f03cd..9903bd70c23 100644 --- a/Master/texmf-dist/tex/latex/pst-moire/pst-moire.sty +++ b/Master/texmf-dist/tex/latex/pst-moire/pst-moire.sty @@ -21,13 +21,13 @@ %% %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \RequirePackage{pstricks} -\ProvidesPackage{pst-moire}[2018/10/28 package wrapper for +\ProvidesPackage{pst-moire}[2018/11/16 package wrapper for pst-moire] \input{pst-moire.tex} \ProvidesFile{pst-moire.tex} [\filedate\space v\fileversion\space `PST-moire'] \IfFileExists{pst-moire.pro}{% \ProvidesFile{pst-moire.pro} - [2018/10/28 v. 1.0, PostScript prologue file] + [2018/11/16 v. 2.0, PostScript prologue file] \@addtofilelist{pst-moire.pro}}{}% \endinput |