diff options
author | Karl Berry <karl@freefriends.org> | 2018-09-24 20:20:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-09-24 20:20:46 +0000 |
commit | f019cbf3107bf60bc648746eb7e2e969c0c494df (patch) | |
tree | 7948f7e7842e392dce7408122b4334b1f95aa365 /Master/texmf-dist | |
parent | c666ec419d70b2df36b9412255690960b7ca918b (diff) |
pst-marble (24sep18)
git-svn-id: svn://tug.org/texlive/trunk@48747 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-marble/README.md | 9 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-marble/pst-marble-doc.pdf | bin | 0 -> 16419314 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-marble/pst-marble-doc.tex | 1692 | ||||
-rw-r--r-- | Master/texmf-dist/dvips/pst-marble/pst-marble.pro | 578 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-marble/pst-marble.tex | 95 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pst-marble/pst-marble.sty | 33 |
6 files changed, 2407 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-marble/README.md b/Master/texmf-dist/doc/generic/pst-marble/README.md new file mode 100644 index 00000000000..77e492e98d1 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-marble/README.md @@ -0,0 +1,9 @@ +% README +% pst-marble v. 01 +% 2018/09/23 + + Source: pst-marble.tex, pst-marble.sty, pst-marble.pro + Author: Aubrey Jaffer, Manuel Luque, Jürgen Gilg + Info: Draw marble-like pattern with PSTricks + License: LPPL 1.3c + diff --git a/Master/texmf-dist/doc/generic/pst-marble/pst-marble-doc.pdf b/Master/texmf-dist/doc/generic/pst-marble/pst-marble-doc.pdf Binary files differnew file mode 100644 index 00000000000..e64da7abba2 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-marble/pst-marble-doc.pdf diff --git a/Master/texmf-dist/doc/generic/pst-marble/pst-marble-doc.tex b/Master/texmf-dist/doc/generic/pst-marble/pst-marble-doc.tex new file mode 100644 index 00000000000..2a9027355e8 --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-marble/pst-marble-doc.tex @@ -0,0 +1,1692 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% This is file `pst-marble-doc.tex' %% +%% %% +%% IMPORTANT NOTICE: %% +%% %% +%% Package `pst-marble' %% +%% %% +%% Aubrey Jaffers, with help of Manuel Luque, Jürgen Gilg %% +%% Email address: agj@alum.mit.edu %% +%% %% +%% This program can redistributed and/or modified under %% +%% the terms of the LaTeX Project Public License %% +%% Distributed from CTAN archives in directory %% +%% macros/latex/base/lppl.txt; either version 1.3c of %% +%% the License, or (at your option) any later version. %% +%% %% +%% DESCRIPTION: %% +%% `pst-marble' is a PSTricks package to draw marble-like patterns %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\listfiles + +\documentclass[% + 11pt, + english, + BCOR10mm, + DIV12, + bibliography=totoc, + parskip=false, + fleqn, + smallheadings, + headexclude, + footexclude, + oneside, + dvipsnames, + svgnames, + x11names +]{pst-doc} + +\usepackage[autostyle]{csquotes} +\usepackage{biblatex} +%\usepackage[style=dtk]{biblatex} +\addbibresource{pst-marble-doc.bib} +\usepackage[utf8]{inputenc} +\let\pstpersFV\fileversion +\usepackage{pstricks,pst-marble,pst-lens,pstricks-add} +\usepackage{amsmath,amssymb} + +\let\belowcaptionskip\abovecaptionskip + +\parindent0pt + +\def\bgImage{% +%\begin{pspicture}(-2.5,-2.5)(2.5,2.5) +%\psframe(-2.5,-2.5)(2.5,2.5) +%\psMarble[actions={ +% 50 -1 add -1 0 +% { +% /cnt exch def +% [ 0 0 +% 1000 50 +% div dup cnt 1 add mul dup mul exch cnt mul dup mul sub sqrt +% phbgc colors cnt colors length mod get /ink ] +% } for anneaux-Aufrey }, +% rasterrendering=false, +% colors={ +% [0.9 0.87 0.6] +% [0.78 0.52 0.72] +% [0.1 0.29 0.4] +% [0.13 0.5 0.51] +% [0.24 0.27 0.6] +% [0.43 0.28 0.32] +% } +% ](5,5) +%\end{pspicture} +} + + +\begin{document} + +\title{pst-marble v 0.1} +\subtitle{A PSTricks package to draw marble-like patterns} +\author{% + Aubrey \textsc{Jaffer}\\ + with the help of\\ + Manuel \textsc{Luque}\\ + Jürgen \textsc{Gilg} +} +\date{\today} + +\maketitle + +\tableofcontents +\psset{unit=1cm} + +\clearpage + +\begin{abstract} +Aubrey Jaffer finds a similarity between whirlwinds in the great spot of jupiter and those that appear in some marbled papers. + +\url{http://voluntocracy.blogspot.com/2018/08/} + +You can see a swirl in a marbled paper on wikipedia: + +\url{https://fr.wikipedia.org/wiki/Papier_marbr%C3%A9#/media/File:PaperMarbling003France1880Detail.jpg} + +It is true that in both cases, although at very different scales, the laws of fluid mechanics apply. + +Aubrey Jaffer's paper on the physical and mathematical interpretation of the formation of various types of marbling: + +\url{https://arxiv.org/abs/1702.02106} + +Aubrey Jaffer and other researchers have done a lot of work to model the marbling phenomena and the results are fine and very close to the reality of the papers made by marbling artists. + +Aubrey Jaffer coded many postscript examples, so we came up with the idea of adapting them to PSTricks in the usual form of a package. + +\vfill +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. +\end{abstract} + +\clearpage + +\section{Theory of marbling by Aubrey Jaffer} + +\url{https://www.computer.org/csdl/mags/cg/2012/06/mcg2012060026-abs.html} + +\url{https://www.computer.org/csdl/mags/cg/2017/02/mcg2017020090.html} + +\url{https://arxiv.org/pdf/1702.02106} + + +\subsection{Introduction} + +Marbling originated in Asia as a decorative art more than 800 years ago and spread to Europe in the 1500s where it was used for endpapers and book covers. + +The mathematical fascination with ink marbling is that while rakings across the tank stretch and deform the ink boundaries, they do not break or change the topology of the surface. With mechanical guides, a raking can be undone by reversing the motion of the rake to its original position. Raking is thus a physical manifestation of a homeomorphism, a continuous function between topological spaces (in this case between a topological space and itself) that has a continuous inverse function. + +\newpage + +\section{Techniques} + +\subsection{Drop ink} + +The first drop of ink placed within water forms a circle with the area $a$. +If a second drop with the area $b$ is placed within the center of the first drop, the total area increases from $a$ to $a+b$. +For the first drop, points very close to the center will change from an infinitely small radius to a radius $ \sqrt{b/\pi}$; and the points of the limit circle will change from $\sqrt{a/\pi}$ to $\sqrt{(a+b)/\pi)} $. +If we take 2 drops of different colors, this gives: +\begin{center} +\begin{pspicture}(-2,-2)(2,2) +\psMarble[L=25,viscosity=120,drawcontours,linewidth=0.2, + background=1 1 1, + actions={ + [ 0 0 100 [] [0 0 1] /ink] + } + ](4,4) +%\pstVerb{/scaleFactor 4 1000 div def} +%\pscircle{!100 scaleFactor mul} +\psgrid[subgriddiv=0,gridcolor=red!30,subgridcolor=green,gridlabels=0pt,griddots=10] +\end{pspicture} +%\hfill +\begin{pspicture}(-2,-2)(2,2) +\psMarble[L=25,viscosity=120,drawcontours,linewidth=0.2, + background=1 1 1, + actions={ + [ 0 0 200 [] [0 0 1] /ink] + [ 0 0 150 [] [1 0 0] /ink] + } + ](4,4) +\psgrid[subgriddiv=0,gridcolor=red!30,subgridcolor=green,gridlabels=0pt,griddots=10] +\end{pspicture} +%\hfill +\begin{pspicture}(-2,-2)(2,2) +\psMarble[L=25,viscosity=120,% drawcontours,linewidth=0.1, + background=1 1 1, + actions={ + [ 0 0 200 [] [0 0 1] /ink] + [ 0 0 150 [] [1 0 0] /ink] + } + ](4,4) +\psgrid[subgriddiv=0,gridcolor=red!30,subgridcolor=green,gridlabels=0pt,griddots=10] +\end{pspicture} +\end{center} +The command to drop a drop is written as follows: +\begin{verbatim} + xc yc R r g b + [ 0 0 100 [] [0 0 1] /ink] +\end{verbatim} +Note that the coordinates of the center of the drop and its radius are in points\footnote {There is a scaling. Example: if the largest dimension of the page is 4, 100 pts will be represented 0.4 cm} and its color is in the system rgb: (values between 0 and 1). + +When we place the second drop of radius $r$ at the point $C(x_C,y_C)$, Aubrey Jaffer considers that this one remains round, intact, but that the first then undergoes the influence of the second and deforms according to the law: +\[ +\vec P'=\vec C+\left(\vec P-\vec C\right)\sqrt{1+{r^2\over \left\|\vec P-\vec C\right\|^2}} +\] +$P(x,y)$ is a point of the first drop and $P'(x',y')$ the transformed point. +\begin{center} +\begin{pspicture}(-2,-2)(2,2) +\psMarble[L=25,viscosity=120, + background=1 1 1, + actions={ + [ 0 0 150 [] [0 0 1] /ink] + } + ](4,4) +%\pstVerb{/scaleFactor 4 1000 div def} +%\pscircle{!100 scaleFactor mul} +\rput(0,0){\white 1} +\psgrid[subgriddiv=0,gridcolor=red!30,subgridcolor=green,gridlabels=0pt,griddots=10] +\end{pspicture} +\hspace{1cm} +\begin{pspicture}(-2,-2)(2,2) +\psMarble[L=25,viscosity=120, + background=1 1 1, + actions={ + [ 0 0 150 [] [0 0 1] /ink] + [ -250 0 150 [] [1 0 0] /ink] + } + ](4,4) +\rput(0,0){\white 1} +\rput(!-250 0.004 mul 0){2} +\psgrid[subgriddiv=0,gridcolor=red!30,subgridcolor=green,gridlabels=0pt,griddots=10] +\end{pspicture} +\end{center} +If a third drop is placed, the two previous drops will then be influenced by the third, which remains intact. +\begin{center} +\begin{pspicture}(-2,-2)(2,2) +\psMarble[L=25,viscosity=120, + background=1 1 1, + actions={ + [ 0 0 150 [] [0 0 1] /ink] + } + ](4,4) +%\pstVerb{/scaleFactor 4 1000 div def} +%\pscircle{!100 scaleFactor mul} +\rput(0,0){\white 1} +\psgrid[subgriddiv=0,gridcolor=red!30,subgridcolor=green,gridlabels=0pt,griddots=10] +\end{pspicture} +\begin{pspicture}(-2,-2)(2,2) +\psMarble[L=25,viscosity=120, + background=1 1 1, + actions={ + [ 0 0 150 [] [0 0 1] /ink] + [ -250 0 150 [] [1 0 0] /ink] + } + ](4,4) +\rput(0,0){\white 1} +\rput(!-250 0.004 mul 0){2} +\psgrid[subgriddiv=0,gridcolor=red!30,subgridcolor=green,gridlabels=0pt,griddots=10] +\end{pspicture} +\begin{pspicture}(-2,-2)(2,2) +\psMarble[L=25,viscosity=120, + background=1 1 1, + actions={ + [ 0 0 150 [] [0 0 1] /ink] + [ -250 0 150 [] [1 0 0] /ink] + [ 250 0 150 [] [0 1 0] /ink] + } + ](4,4) +\rput(0,0){\white 1} +\rput(!-250 0.004 mul 0){2} +\rput(!250 0.004 mul 0){3} +\psgrid[subgriddiv=0,gridcolor=red!30,subgridcolor=green,gridlabels=0pt,griddots=10] +\end{pspicture} +\end{center} +All drops are influenced by the last drop deposited. + +\subsection{Random drops} + +One of the techniques is to project with a brush drops of color on the surface of the liquid in several stages by changing color. The position of the drops is therefore random. Each drop influences its neighbors and assuming that initially the drops would form a round spot on the surface, they will deform depending on the size and proximity of neighbors. The modeling of this phenomenon has been studied in the document ``\textit{Mathematical Marbling}'' by Shufang Lu, Aubrey Jaffer, Xiaogang Jin, Hanli Zhao and Xiaoyang Mao. + +\centerline{\url{http://people.csail.mit.edu/jaffer/Marbling/Mathematics}} + +\centerline{\url{https://www.computer.org/csdl/mags/cg/2012/06/mcg2012060026-abs.html}} + +Then, with a fine stick, a comb one tries to draw the marbling. + +The following example illustrates that technique. Three steps with drops of different size and color on which 2 swirls are applied. +\begin{center} +\begin{pspicture}(-3,-6)(3,6) +\psMarble[L=100, + actions={ + 250 { + [random:uniform 1000 mul 500 sub % -500 <x<500 + random:uniform 1000 mul 500 sub % -500 <y<500 + 30 background [0.960 0.764 0.576] /ink] + } repeat + 200 { + [random:uniform 1000 mul 500 sub % -500 <x<500 + random:uniform 1000 mul 500 sub % -500 <y<500 + 25 background [0.270 0.035 0.058] /ink] + } repeat + 100 { + [random:uniform 1000 mul 500 sub % -500 <x<500 + random:uniform 1000 mul 500 sub % -500 <y<500 + 20 background [0.866 0.353 0.000 ] /ink] + } repeat + [ 300 200 300 /vortex] + [ 0 -300 300 /vortex]}](6,12) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-3,-6)(3,6) +\psMarble[L=100, + actions={ + 250 { + [random:uniform 1000 mul 500 sub % -500 <x<500 + random:uniform 1000 mul 500 sub % -500 <y<500 + 30 background [0.960 0.764 0.576] /ink] + } repeat + 200 { + [random:uniform 1000 mul 500 sub % -500 <x<500 + random:uniform 1000 mul 500 sub % -500 <y<500 + 25 background [0.270 0.035 0.058] /ink] + } repeat + 100 { + [random:uniform 1000 mul 500 sub % -500 <x<500 + random:uniform 1000 mul 500 sub % -500 <y<500 + 20 background [0.866 0.353 0.000 ] /ink] + } repeat + [ 300 200 300 /vortex] + [ 0 -300 300 /vortex]}](6,12) +\end{pspicture} +\end{verbatim} + +\subsection{Concentric rings} + +Aubrey Jaffer describes the idea of ``concentric rings'' in: +\begin{center} +\url{http://people.csail.mit.edu/jaffer/Marbling/Mathematics} +\end{center} +\begin{quote}\itshape +``At the start of the real marbling process, inks are dropped from one or more locations to form expanding disks on a substrate. The mathematics is described in \href{http://people.csail.mit.edu/jaffer/Marbling/Dropping-Ink}{\emph{Dropping Ink}}. For now, we just want an ink pattern which shows subsequent displacements. In my first renderings, 5 virtual inks are dropped from the center to form 25 concentric rings of equal radial width. + +The boundaries between virtual ink rings will be traversed using the Minsky circle algorithm; although walking the circles using coordinates generated by sin and cos would work as well. The angular step size is made inversely proportional to the ring radius, making the distance between successive points uniform.'' +\end{quote} +\begin{center} +\begin{pspicture}(-2,-2)(2,2) +\psMarble[actions={concentric-bands}](3,3) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-2,-2)(2,2) +\psMarble[actions={concentric-bands}](3,3) +\end{pspicture} +\end{verbatim} + +\newpage + +\section{The command \Lcs{psMarble}} + +\begin{BDef} +\Lcs{psMarble}\OptArgs\Largr{x , y} +\end{BDef} + +The command \Lcs{psMarble} contains the options \nxLkeyword{actions=}, \nxLkeyword{background=}, \nxLkeyword{resolution=}, \nxLkeyword{viscosity=}, \nxLkeyword{L=}, \nxLkeyword{drawcontours=true/false} and \nxLkeyword{colors=}. + +The optional argument \Largr{x , y} gives the \texttt{x} and \texttt{y} dimension of the image---the default is \Largr{10,10}. +\begin{quote} +\begin{tabularx}{\linewidth}{ @{} l >{\ttfamily}l X @{} }\toprule +\textbf{Name} & \textbf{Default} & \textbf{Meaning} \\\midrule +\Lkeyword{actions} & concentric-bands & the type of marbling\\ +\Lkeyword{background} & 0 0 0 & background color\\ +\Lkeyword{colors} & \parbox{5cm}{ + [0.376 0.357 0.451] + [0.255 0.259 0.341] + [0.306 0.498 0.62 ] + [0.686 0.741 0.851] + [0.353 0.529 0.627] + }% + & colors of the marbling within the rgb-system\\ +\Lkeyword{drawcontours} & false &if set to \texttt{true} it only draws the contours\\ +\Lkeyword{resolution} & 1 & resolution=1 is the pixel size 1 pt, resolution=0.5 is the pixel size 0.5 pt \\ +\Lkeyword{viscosity} & 25 & system (ink/fluid) constant\\ +\Lkeyword{L} & 200 & system (ink/fluid) constant (if taken negative, it pixels)\\ +\bottomrule +\end{tabularx} +\end{quote} + +\textbf{Notes:} +\begin{itemize} +\item If \texttt{L<0}, the image will be pixeled. The size of the pixels can then be changed by the option \texttt{resolution=1} or \texttt{resolution=0.5}. If \texttt{L>0}, the option \texttt{resolution=} is out of effect. +\item Following are introduced some basic deformation actions, like \texttt{/line}, \texttt{/stroke}, \texttt{/circle}, \texttt{/vortex}, \texttt{/wiggle}. + + Within \texttt{/circle} and \texttt{/vortex} there are defined some radii \texttt{r}. If \texttt{r>0} is chosen, the deformation is anticlockwise, if positive the deformation is clockwise. The angle of deformation is calculated by: radius/PC (PC = distance to center) +\item The boolean option \texttt{drawcontours} is by default set to \texttt{false}. If set to true, only the contours are drawn within the image. +\item All colors are to be setup within the rgb-color-system. +\end{itemize} + +\newpage + +\section{Rendering} + +As designs get more complicated, hundreds of drops and strokes, reverse-rendering is the only practical way to render them. As the number of strokes increases, the number of points in the contours needs to increase as well. As the number of drops increases, the time to compute each pixel becomes less than the time to compute each contour-point on the drops. + +The reason that we don't always reverse-render is because its resolution is limited to the raster; forward-rendering designs remain crisp at any magnification. +\begin{itemize} +\item To use forward-rendering (pixelfree) we choose the option \texttt{L>0} with a positive value. +\item To use reverse-rendering (pixeled) we choose the option \texttt{L<0} with a negative value. In that case the option \texttt{resolution=} gets into action to vary the size of the pixels. Setting \texttt{resolution=1}, the pixel size is set to 1 pt; \texttt{resolution=0.5} sets the pixel size to 0.5 pt. In this case we consider the surface as a grid of points (square pixels of side 1pt) and each drop is represented by the points situated between its edges. When a new drop is placed, the points in that drop retain their color, the outer points are calculated before being assigned their initial color. This possibility is operational by taking for L (characteristic length of the system) a negative value. +\end{itemize} +\begin{center} +\begin{pspicture}(-3,-3)(3,3) +\psMarble[L=-100,viscosity=20,resolution=1,actions={concentric-bands}](6,6) +\end{pspicture} +\hfill +\begin{pspicture}(-3,-3)(3,3) +\psMarble[L=-100,viscosity=20,resolution=0.5,actions={concentric-bands}](6,6) +\end{pspicture} +\end{center} + +\begin{minipage}[t]{0.45\linewidth}\kern0pt +\begin{verbatim} +\begin{pspicture}(-3,-3)(3,3) +\psMarble[L=-100,viscosity=20, +resolution=1, +actions={concentric-bands}](6,6) +\end{pspicture} +\end{verbatim} +\end{minipage} +\hfill +\begin{minipage}[t]{0.45\linewidth}\kern0pt +\begin{verbatim} +\begin{pspicture}(-3,-3)(3,3) +\psMarble[L=-100,viscosity=20, +resolution=0.5, +actions={concentric-bands}](6,6) +\end{pspicture} +\end{verbatim} +\end{minipage} + + +\newpage + +\section{Colors} + +All colors are setup within the rgb-color-system. Besides the preset \nxLkeyword{colors=} which are initially setup within the \texttt{pst-marble.pro}, we can change them within the concentric circles basic figure \texttt{concentric-bands} as follows: +\begin{center} +\begin{pspicture}(-3,-3)(3,3) +\psMarble[actions={concentric-bands}](6,6) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-3,-3)(3,3) +\psMarble[actions={concentric-bands}](6,6) +\end{pspicture} +\end{verbatim} +\begin{center} +\begin{pspicture}(-3,-3)(3,3) +\psMarble[colors={ + [0.812 0.961 0.522] + [0.745 0.937 0.357] + [0.655 0.878 0.212] + [0.541 0.780 0.071] + [0.416 0.612 0.002] + }, + actions={concentric-bands}](6,6) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-3,-3)(3,3) +\psMarble[colors={ + [0.812 0.961 0.522] + [0.745 0.937 0.357] + [0.655 0.878 0.212] + [0.541 0.780 0.071] + [0.416 0.612 0.002] + }, + actions={concentric-bands}](6,6) +\end{pspicture} +\end{verbatim} + +\newpage + +\section{Predefined objects before deformation} + +\subsection{\texttt{/ink}} + +\texttt{/ink} defines a drop set on the surface of a liquid. +\begin{verbatim} + xc yc R r g b +[ 0 0 100 [] [0 0 1] /ink] +\end{verbatim} +This initially is a circle with the center \texttt{(xc,yc)} and radius \texttt{R}. The ink color is defined by the rgb-System. The empty slot \texttt{[]} is the background ink color. + +In order to interpolate the color in reverse-rendering, the adjacent color must be known. Code in \texttt{/marble} initializes the empty slot from +the inks in \texttt{/actions}. +\begin{center} +\begin{pspicture}(-3,-3)(3,3) +\psMarble[background=1 1 1, %white +actions={% +[ 0 0 50 [] [1 0 0] /ink] +[ -200 0 70 [] [0 1 0] /ink] +[ 200 0 100 [] [0 0 1] /ink] +}](6,6) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-3,-3)(3,3) +\psMarble[background=1 1 1, %white +actions={% +[ 0 0 50 [] [1 0 0] /ink] +[ -200 0 70 [] [0 1 0] /ink] +[ 200 0 100 [] [0 0 1] /ink] +}](6,6) +\end{pspicture} +\end{verbatim} +\textbf{Note:} The ink drop top most on the stack is left undeformed (intact), whereas all the others are influenced by each other according to the system constants. There are as well 6 colors predefined which can be used like that: +\begin{verbatim} +[ 0 0 50 [] color1 /ink] +[ -200 0 70 [] color2 /ink] +[ 200 0 100 [] color3 /ink] +\end{verbatim} + +\newpage + +\subsection{concentric-bands} + +A set of concentric circles can be setup by \texttt{actions=concentric-bands} to then let some deformation happen. +\begin{center} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[actions={concentric-bands}](10,10) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[actions={concentric-bands}](10,10) +\end{pspicture} +\end{verbatim} + +\newpage + +\section{Basic deformation actions} + +Some of the deformation \nxLkeyword{actions=} which are initially setup within the \texttt{pst-marble.pro} can be manually changed by its parameters: + +\subsection{\texttt{/line-deformation}} + +The documentation is on the web page: + +\centerline{ +\url{http://people.csail.mit.edu/jaffer/Marbling/Mathematics} +} +\begin{center} +\begin{pspicture*}(-5,-5)(5,5) +\psMarble[L=100,viscosity=50, + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands +% pour les formules voir : +% http://people.csail.mit.edu/jaffer/Marbling/Mathematics +% px py dx dy xs [ ys ] --> px py +% px py dx dy [ xs ] ys --> px py +% dx dy direction du déplacement +% dx dy xB yB + [ -1 -1 normalize [ -100 ] 100 /line] + }] +\pstVerb{/scaleFactor 10 1000 div def + /xB1 -100 scaleFactor mul def + /yB1 100 scaleFactor mul def + }% +\rput(!xB1 yB1){\psline{->}(5,5)(-4,-4)\psline[linecolor=red,linewidth=0.1]{->}(-0.707,-0.707)\psdot[linecolor=red,linewidth=0.1]} +\end{pspicture*} +\end{center} +\begin{verbatim} +\begin{pspicture*}(-5,-5)(5,5) +\psMarble[L=100,viscosity=50, + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands +% pour les formules voir : +% http://people.csail.mit.edu/jaffer/Marbling/Mathematics +% px py dx dy xs [ ys ] --> px py +% px py dx dy [ xs ] ys --> px py +% dx dy direction du déplacement +% dx dy xB yB + [ -1 -1 normalize [ -100 ] 100 /line] + }] +\pstVerb{/scaleFactor 10 1000 div def + /xB1 -100 scaleFactor mul def + /yB1 100 scaleFactor mul def + }% +\rput(!xB1 yB1){\psline{->}(5,5)(-4,-4) + \psline[linecolor=red,linewidth=0.1]{->}(-1,-1) + \psdot[linecolor=red,linewidth=0.1]} +\end{pspicture*} +\end{verbatim} + +The base figure is setup by a family of concentric colored circles: ``\texttt{concentric-bands}'', this command can be found within the file \texttt{pst-marble.pro} of the package. The command \texttt{/line} applies to all the points $(x,y)$ of the circle. +\begin{verbatim} + x y dx dy xs [ ys ] --> x' y' + x y dx dy [ xs ] ys --> x' y' +\end{verbatim} +The line is determinded by a point \texttt{(xS,yS)} and a unitary vector given by the couple of values \texttt{(dx,dy)} which determine the direction of the displacement. Within the command, the coordinates $(x,y)$ are automatically put on the stack. The length and amplitude of the displacement are coupled to the viscosity and the characteristic system constant. This unitary vector \texttt{(dx,dy)} could if necessary be normalized by the following \verb+-1.5 -1 normalize+. One now can setup different values for \texttt{L} and \texttt{viscosity} to observe the resulting effects. +\begin{center} +\begin{pspicture*}(-5.5,-5.5)(5.5,5.5) +\psMarble[L=100,viscosity=100, + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands +% pour les formules voir : +% http://people.csail.mit.edu/jaffer/Marbling/Mathematics +% px py dx dy xs [ ys ] --> px py +% px py dx dy [ xs ] ys --> px py +% dx dy direction du déplacement +% dx dy xB yB + [ -1.5 -1 normalize [ 0 ] 0 /line] + }] +\psline{->}(8.32050323,5.54700196)(-8.32050323,-5.54700196) +\psline[linecolor=red,linewidth=0.1]{->}(-0.832050323,-0.554700196)\psdot[linecolor=red,linewidth=0.1] +\psgrid[subgriddiv=0,griddots=5,gridlabels=10pt](-5,-5)(5,5) +\end{pspicture*} +\end{center} +\begin{verbatim} + [ -1.5 -1 normalize [ 0 ] 0 /line] +\end{verbatim} +One can setup a series of values for xs in brackets: \texttt{[xs1 xs2 ...]}, or for ys: \texttt{[ys1 ys2 ...]} which define a series of deformation lines. +\begin{center} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[L=200,viscosity=20, + actions={concentric-bands +% pour les formules voir : +% http://people.csail.mit.edu/jaffer/Marbling/Mathematics +% px py dx dy xs [ ys ] --> px py +% px py dx dy [ xs ] ys --> px py +% dx dy direction du déplacement +% dx dy xs1 xs2 ys + % [ 0 -1 [ -500 -400 -300 -200 -100 0 100 200 300 400 500 ] 0 /line] + [ 0 -1 [ -500 100 500 {} for ] 0 /line] + }] +\multido{\i=-5+1}{11}{\psline[linecolor=red](\i,-5)(\i,5)} +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[L=200,viscosity=20, + actions={concentric-bands +% pour les formules voir : +% http://people.csail.mit.edu/jaffer/Marbling/Mathematics +% px py dx dy xs [ ys ] --> px py +% px py dx dy [ xs ] ys --> px py +% dx dy direction du déplacement +% dx dy xs1 xs2 ys + % [ 0 -1 [ -500 -400 -300 -200 -100 0 100 200 300 400 500 ] 0 /line] + [ 0 -1 [ -500 100 500 {} for ] 0 /line] + }] +\multido{\i=-5+1}{11}{\psline[linecolor=red](\i,-5)(\i,5)} +\end{pspicture} +\end{verbatim} +\begin{center} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[L=200,viscosity=20, + actions={concentric-bands +% pour les formules voir : +% http://people.csail.mit.edu/jaffer/Marbling/Mathematics +% px py dx dy xs [ ys ] --> px py +% px py dx dy [ xs ] ys --> px py +% dx dy direction du déplacement +% dx dy xs ys1 ys2 ............ + [1 0 0 [ -500 100 500 {} for ] /line] + }] +\multido{\i=-5+1}{11}{\psline[linecolor=red](-5,\i)(5,\i)} +\end{pspicture} +\end{center} +\begin{verbatim} +\psMarble[L=200,viscosity=20, + actions={concentric-bands +% pour les formules voir : +% http://people.csail.mit.edu/jaffer/Marbling/Mathematics +% px py dx dy xs [ ys ] --> px py +% px py dx dy [ xs ] ys --> px py +% dx dy direction du déplacement +% dx dy xs ys1 ys2 ............ + [1 0 0 [ -500 100 500 {} for ] /line] + }] +\multido{\i=-5+1}{11}{\psline[linecolor=red](-5,\i)(5,\i)} +\end{pspicture} +\end{verbatim} + +\newpage + +\subsection{\texttt{/stroke-deformation}} + +The documentation is on the web page: + +\centerline{ +\url{http://people.csail.mit.edu/jaffer/Marbling/Mathematics} +} + +Parameters for \texttt{/stroke-deformation}: \texttt{bx, by, ex, ey, wid} + +\texttt{bx, by} is the start point of the stroke. \texttt{ex, ey} is the end point of the stroke. \texttt{wid} is a system constant. +\begin{verbatim} +/stroke-deformation +% px py [ bx by ex ey wid ] --> px py +\end{verbatim} +\begin{center} +%Parameters: wid=50 +\begin{pspicture}(-5,-5)(5,5) +\psMarble[L=200,viscosity=25, +actions={concentric-bands +% X1 begin Y1 begin X2 end Y2 end wid grandeur system +[ 30 sin 400 mul 30 cos 400 mul 30 sin 100 mul 30 cos 100 mul 50 /stroke ] +}](10,10) +\psset{linecolor=red,linewidth=0.1} +\pstVerb{/scaleFactor 10 1000 div def +/X1 30 sin 400 mul scaleFactor mul def +/Y1 30 cos 400 mul scaleFactor mul def +/X2 30 sin 100 mul scaleFactor mul def +/Y2 30 cos 100 mul scaleFactor mul def +}% +\psdots(!X1 Y1)(!X2 Y2) +\psline{->}(!X1 Y1)(!X2 Y2) +\end{pspicture} +\end{center} +\begin{verbatim} +%Parameters: wid=50 +\begin{pspicture}(-5,-5)(5,5) +\psMarble[L=200,viscosity=25, +actions={concentric-bands +% X1 begin Y1 begin X2 end Y2 end wid grandeur system +[ 30 sin 400 mul 30 cos 400 mul 30 sin 100 mul 30 cos 100 mul 50 /stroke ] +}](10,10) +\psset{linecolor=red,linewidth=0.1} +\pstVerb{/scaleFactor 10 1000 div def +/X1 30 sin 400 mul scaleFactor mul def +/Y1 30 cos 400 mul scaleFactor mul def +/X2 30 sin 100 mul scaleFactor mul def +/Y2 30 cos 100 mul scaleFactor mul def +}% +\psdots(!X1 Y1)(!X2 Y2) +\psline{->}(!X1 Y1)(!X2 Y2) +\end{pspicture} +\end{verbatim} + +\begin{center} +%Parameters: wid=200 +\begin{pspicture}(-5,-5)(5,5) +\psMarble[L=200,viscosity=25, +actions={concentric-bands +% X1 begin Y1 begin X2 end Y2 end wid grandeur system +[ 30 sin 400 mul 30 cos 400 mul 30 sin 100 mul 30 cos 100 mul 200 /stroke ] +}](10,10) +\psset{linecolor=red,linewidth=0.1} +\pstVerb{/scaleFactor 10 1000 div def +/X1 30 sin 400 mul scaleFactor mul def +/Y1 30 cos 400 mul scaleFactor mul def +/X2 30 sin 100 mul scaleFactor mul def +/Y2 30 cos 100 mul scaleFactor mul def +}% +\psdots(!X1 Y1)(!X2 Y2) +\psline{->}(!X1 Y1)(!X2 Y2) +\end{pspicture} +\end{center} +\begin{verbatim} +%Parameters: wid=200 +\begin{pspicture}(-5,-5)(5,5) +\psMarble[L=200,viscosity=25, +actions={concentric-bands +% X1 begin Y1 begin X2 end Y2 end wid grandeur system +[ 30 sin 400 mul 30 cos 400 mul 30 sin 100 mul 30 cos 100 mul 200 /stroke ] +}](10,10) +\psset{linecolor=red,linewidth=0.1} +\pstVerb{/scaleFactor 10 1000 div def +/X1 30 sin 400 mul scaleFactor mul def +/Y1 30 cos 400 mul scaleFactor mul def +/X2 30 sin 100 mul scaleFactor mul def +/Y2 30 cos 100 mul scaleFactor mul def +}% +\psdots(!X1 Y1)(!X2 Y2) +\psline{->}(!X1 Y1)(!X2 Y2) +\end{pspicture} +\end{verbatim} + +\newpage + +\subsection{\texttt{/circle-deformation}} + +The parameters to be passed to the command \texttt{/circle} are the coordinates of the center of the circle \texttt{(xC yC)} and its radius \texttt{r} in pts. If \texttt{r} is set to positive values the circle deformation goes anti-clockwise otherwise clockwise. +\begin{verbatim} + [ xC yC [ r ] /circle ] +\end{verbatim} +Within the brackets one can setup multiple radii, see example on page \pageref{ripple}. +\begin{center} +\begin{pspicture*}(-4,-4)(4,4) +\psMarble[ + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands +% coordonnées et dimensions en pts +% xC yC rayon + [ -320 -200 [ 350 ] /circle ] + }](8,8) +% dimension de la page 8 cm +% le facteur d'échelle 8/1000 % message de Aubrey +% les coordonnées du centre et le rayon sont à calculer avec ce facteur +\psset{linecolor=red} +\pstVerb{/scaleFactor 8 1000 div def}% +\psdot(!-320 scaleFactor mul -200 scaleFactor mul) % le centre +\pscircle(!-320 scaleFactor mul -200 scaleFactor mul){!350 scaleFactor mul} +\end{pspicture*} +\end{center} +\begin{verbatim} +\begin{pspicture*}(-4,-4)(4,4) +\psMarble[ + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands +% coordonnées et dimensions en pts +% xC yC rayon + [ -320 -200 [ 350 ] /circle ] + }](8,8) +% dimension de la page 8 cm +% le facteur d'échelle 8/1000 +% les coordonnées du centre et le rayon sont à calculer avec ce facteur +\psset{linecolor=red} +\pstVerb{/scaleFactor 8 1000 div def}% +\psdot(!-320 scaleFactor mul -200 scaleFactor mul) % le centre +\pscircle(!-320 scaleFactor mul -200 scaleFactor mul){!350 scaleFactor mul} +\end{pspicture*} +\end{verbatim} +\begin{center} +\begin{pspicture*}(-4,-4)(4,4) +\psMarble[ + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands +% coordonnées et dimensions en pts +% xC yC rayon + [ -320 -200 [ 350 ] /circle ] + [ 320 200 [ 350 ] /circle ] + }](8,8) +% dimension de la page 8 cm +% le facteur d'échelle 8/1000 +% les coordonnées du centre et le rayon sont à calculer avec ce facteur +\pstVerb{/scaleFactor 8 1000 div def}% +\psset{linecolor=red} +\psdot(!-320 scaleFactor mul -200 scaleFactor mul) % le centre +\pscircle(!-320 scaleFactor mul -200 scaleFactor mul){!350 scaleFactor mul} +\psdot(!320 scaleFactor mul 200 scaleFactor mul) % le centre +\pscircle(!320 scaleFactor mul 200 scaleFactor mul){!350 scaleFactor mul} +\end{pspicture*} +\end{center} +\begin{verbatim} +\begin{pspicture*}(-4,-4)(4,4) +\psMarble[ + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands +% coordonnées et dimensions en pts +% xC yC rayon + [ -320 -200 [ 350 ] /circle ] + [ 320 200 [ 350 ] /circle ] + }](8,8) +% dimension de la page 8 cm +% le facteur d'échelle 8/1000 +% les coordonnées du centre et le rayon sont à calculer avec ce facteur +\pstVerb{/scaleFactor 8 1000 div def}% +\psset{linecolor=red} +\psdot(!-320 scaleFactor mul -200 scaleFactor mul) % le centre +\pscircle(!-320 scaleFactor mul -200 scaleFactor mul){!350 scaleFactor mul} +\psdot(!320 scaleFactor mul 200 scaleFactor mul) % le centre +\pscircle(!320 scaleFactor mul 200 scaleFactor mul){!350 scaleFactor mul} +\end{pspicture*} +\end{verbatim} + +\newpage + +\subsection{\texttt{/vortex-deformation}} + +Parameters for \texttt{/vortex-deformation}: \texttt{cx, cy, rad} + +\texttt{cx, cy} is the center of the vortex. \texttt{rad} is the radius of the vortex. If \texttt{rad} is set to positive values the +vortex deformation goes anti-clockwise otherwise it goes clockwise. + +\begin{center} +\begin{pspicture}(-5,-5)(5,5) +%Parameters: rad=200, L=200 +\psMarble[L=200, +actions={concentric-bands +% cx cy rad +[100 200 200 /vortex] +}](10,10) +\pstVerb{/scaleFactor 10 1000 div def +/xC 100 scaleFactor mul def +/yC 200 scaleFactor mul def +}% +\psdot[linecolor=red,linewidth=0.1](!xC yC) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +%Parameters: rad=200, L=200 +\psMarble[L=200, +actions={concentric-bands +% cx cy rad +[100 200 200 /vortex] +}](10,10) +\pstVerb{/scaleFactor 10 1000 div def +/xC 100 scaleFactor mul def +/yC 200 scaleFactor mul def +}% +\psdot[linecolor=red,linewidth=0.1](!xC yC) +\end{pspicture} +\end{verbatim} + +\begin{center} +\begin{pspicture}(-5,-5)(5,5) +%Parameters: rad=500, L=200 +\psMarble[L=200, +actions={concentric-bands +% cx cy rad +[100 200 500 /vortex] +}](10,10) +\pstVerb{/scaleFactor 10 1000 div def +/xC 100 scaleFactor mul def +/yC 200 scaleFactor mul def +}% +\psdot[linecolor=red,linewidth=0.1](!xC yC) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +%Parameters: rad=500, L=200 +\psMarble[L=200, +actions={concentric-bands +% cx cy rad +[100 200 500 /vortex] +}](10,10) +\pstVerb{/scaleFactor 10 1000 div def +/xC 100 scaleFactor mul def +/yC 200 scaleFactor mul def +}% +\psdot[linecolor=red,linewidth=0.1](!xC yC) +\end{pspicture} +\end{verbatim} + +\newpage + +\subsection{\texttt{/wiggle}} + +The documentation is on the web page: + +\centerline{ +\url{http://people.csail.mit.edu/jaffer/Marbling/Mathematics} +} +\texttt{/wiggle} allows to realize deformations with an adequate function. + +Aubrey Jaffer coded this following command: +\begin{verbatim} +/wiggle % px py dx dy {func} --> px py +{ + /func exch def + /dy exch def /dx exch def + /py exch def /px exch def + /a py dx mul px dy mul sub func exec reverse-rendering? {neg} if def + px dx a mul add py dy a mul add +} bind def +\end{verbatim} +\texttt{(dx,dy)} represents a unitary vector which gives direction to the wanted deformation by $(u_x,u_y)$. +\[ +a=f(y u_x -xu_y)\Longrightarrow x'=x+au_x;\ y'=y+au_y +\] +If one wants to obtain a sinusoidial wave parallel to the axis $Oy$, one takes \texttt{dx=1} and \texttt{dy=0} and for the function for example $45\sin(5y)$ which in PS-code is: \texttt{\{5 mul sin 45 mul\}} and thus: $x'=x+45\sin(5y);\ y'=y$. Note that the coordinates are calculated in points. +\begin{center} +\begin{pspicture}(-5,-5)(5,5) +% sinusoïde d'axe // oy +\psMarble[L=100, + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands + [1 0 {5 mul sin 45 mul} /wiggle] + }] +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +% sinusoïde d'axe // oy +\psMarble[L=100, + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands + [1 0 {5 mul sin 45 mul} /wiggle] + }] +\end{pspicture} +\end{verbatim} +To get waves that are upright, we write: +\begin{center} +\begin{pspicture}(-5,-5)(5,5) +% sinusoïde d'axe // ox +\psMarble[L=100, + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands + [0 1 {5 mul sin 45 mul} /wiggle] + }] +\end{pspicture} +\end{center} +\begin{verbatim} +% sinusoïde d'axe // ox +\psMarble[L=100, + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands + [0 1 {5 mul sin 45 mul} /wiggle] + }] +\end{pspicture} +\end{verbatim} +For inclined/oblique waves, we write: +\begin{center} +\begin{pspicture}(-5,-5)(5,5) +% sinusoïde oblique +\psMarble[L=100, + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands + [1 1 normalize {5 mul sin 45 mul} /wiggle] + }] +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +% sinusoïde oblique +\psMarble[L=100, + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands + [1 1 normalize {5 mul sin 45 mul} /wiggle] + }] +\end{pspicture} +\end{verbatim} +\textbf{Note:} If the vector is not unitary, we write the following to normalize it: \texttt{1 1 normalize}. + +\textbf{Remark:} These transformations can be combined and also be reversed, example: +\begin{center} +\begin{pspicture}(-5,-7)(5,7) +\psMarble[ + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands + [1 0 {3 mul sin 30 mul } /wiggle ] + [1 0 {3 mul sin -30 mul } /wiggle ] + }](10,14) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-5,-7)(5,7) +\psMarble[ + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={concentric-bands + [1 0 {3 mul sin 30 mul } /wiggle ] + [1 0 {3 mul sin -30 mul } /wiggle ] + }](10,14) +\end{pspicture} +\end{verbatim} + +\newpage + +\subsection{\texttt{/offset}} + +\begin{verbatim} +/offset % px py dx dy --> px py +{ + /dy exch def /dx exch def + dy reverse-rendering? {neg} if add exch + dx reverse-rendering? {neg} if add exch +} bind def +\end{verbatim} +The choice of units was made, so that 100 pts correspond to 1 cm within the image. +\begin{center} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[L=100,viscosity=50, + actions={concentric-bands +% dx dy + [100 100 /offset]}] +\pstVerb{/scaleFactor 10 1000 div def + /xS1 100 scaleFactor mul def + /yS1 100 scaleFactor mul def + }% +\rput(!xS1 yS1){\psline(0.5,0)(-0.5,0)\psline(0,0.5)(0,-0.5)} +\psline[linestyle=dashed](-5,0)(5,0) +\psline[linestyle=dashed](0,-5)(0,5) +\psline[linecolor=red]{->}(0,0)(1,1) +\end{pspicture} +\end{center} +The displacement vector is given by \texttt{dx} and \texttt{dy} in pts. +\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[L=100,viscosity=50, + actions={concentric-bands +% dx dy + [100 100 /offset]}] +\pstVerb{/scaleFactor 10 1000 div def + /xS1 100 scaleFactor mul def + /yS1 100 scaleFactor mul def + }% +\rput(!xS1 yS1){\psline(0.5,0)(-0.5,0)\psline(0,0.5)(0,-0.5)} +\psline[linestyle=dashed](-5,0)(5,0) +\psline[linestyle=dashed](0,-5)(0,5) +\psline[linecolor=red]{->}(0,0)(1,1) +\end{pspicture} +\end{verbatim} + +\newpage + +\section{Combined actions} + +Some basic actions set together. One can create some quite artistic images. + +\textbf{Note:} The order of the actions is of importance! Also the direction of the deformation is important! + +\subsection{Bouquets} + +\begin{center} +\begin{pspicture}(-4.5,-4.5)(4.5,4.5) +\psMarble[ + L=200, + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={ + concentric-bands +% [ 0 0 20 background color1 /ink] + [ 0 120 /offset] + [ 0 -1 [ -460 60 460 {} for ] 0 /line] + [ 1 0 {0.75 mul sin -120 mul} /wiggle] + [ 0 -1 [-750 -150 450] 0 /line ] + [ 1 0 {0.75 mul sin 240 mul} /wiggle ] + [ 0 -1 [-450 150 750] 0 /line ] + [ 1 0 {0.75 mul sin -120 mul} /wiggle ] + }](9,9) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-4.5,-4.5)(4.5,4.5) +\psMarble[ + L=200, + colors={ + [0.134 0.647 1.0 ] + [0.977 0.855 0.549] + [0.684 0.638 0.702] + [0.73 0.965 0.942 ] + [0.04 0.236 0.424 ] + }, + actions={ + concentric-bands +% [ 0 0 20 background color1 /ink] + [ 0 120 /offset] + [ 0 -1 [ -460 60 460 {} for ] 0 /line] + [ 1 0 {0.75 mul sin -120 mul} /wiggle] + [ 0 -1 [-750 -150 450] 0 /line ] + [ 1 0 {0.75 mul sin 240 mul} /wiggle ] + [ 0 -1 [-450 150 750] 0 /line ] + [ 1 0 {0.75 mul sin -120 mul} /wiggle ] + }](9,9) +\end{pspicture} +\end{verbatim} + +\newpage + +\subsection{Fern} + +\begin{center} +\begin{pspicture}(-5,-10)(5,10) +\psMarble[L=100,viscosity=20, +colors={ +[0.659 0.859 0.573] +[0.467 0.718 0.357] +[0.306 0.573 0.192] +[0.180 0.431 0.071] +[0.086 0.286 0.000] +}, +actions={concentric-bands +[ -1 0 0 [-400 50 400 {} for] /line] +[ 0 300 100 /vortex] +[ 0 100 100 /vortex] +[ 0 -100 100 /vortex] +[ 0 -300 100 /vortex] +}](10,20) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-5,-10)(5,10) +\psMarble[L=100,viscosity=20, +colors={ +[0.659 0.859 0.573] +[0.467 0.718 0.357] +[0.306 0.573 0.192] +[0.180 0.431 0.071] +[0.086 0.286 0.000] +}, +actions={concentric-bands +[ -1 0 0 [-400 50 400 {} for] /line] +[ 0 300 100 /vortex] +[ 0 100 100 /vortex] +[ 0 -100 100 /vortex] +[ 0 -300 100 /vortex] +}](10,20) +\end{pspicture} +\end{verbatim} + + +\begin{center} +\begin{pspicture}(-5,-5)(5,5) +\newpsstyle{YellowGlass}{linewidth=0.1,linecolor=gray,fillstyle=solid,fillcolor=gray} +\newpsstyle{LensStyleHandle}{% +fillstyle=gradient,framearc=0.6,linewidth=0.5\pslinewidth, +gradmidpoint=0.5,gradangle=45,gradbegin=white,gradend=gray} +\psset{L=100,viscosity=10,background=1 1 1, + actions={ + 4 -1 1 + { + /rad exch sqrt 100 mul def + [ 0 0 rad background color1 /ink] + [ 0 0 rad background color2 /ink] + [ 0 0 rad background color3 /ink] + [ 0 0 rad background color4 /ink] + [ 0 0 rad background color5 /ink] + [ 0 0 rad background color6 /ink] + } for + [-800 0 [ -750 ] /circle] [800 0 [ -750 ] /circle] + [-500 0 [ -400 ] /circle] [500 0 [ -400 ] /circle] + [-300 0 [ -200 ] /circle] [300 0 [ -200 ] /circle] + [-250 0 [ -100 ] /circle] [250 0 [ -100 ] /circle] + }}% +\psMarble(10,10) +\PstLens[LensMagnification=2.5,LensRotation=45,LensSize=2,LensShadow=false,LensStyleGlass=YellowGlass](1,-1){% +\psMarble(10,10)} +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\newpsstyle{YellowGlass}{linewidth=0.1,linecolor=gray, + fillstyle=solid,fillcolor=gray} +\newpsstyle{LensStyleHandle}{% +fillstyle=gradient,framearc=0.6,linewidth=0.5\pslinewidth, +gradmidpoint=0.5,gradangle=45,gradbegin=white,gradend=gray} +\psset{L=100,viscosity=10,background=1 1 1, + actions={ + 4 -1 1 + { + /rad exch sqrt 100 mul def + [ 0 0 rad background color1 /ink] + [ 0 0 rad background color2 /ink] + [ 0 0 rad background color3 /ink] + [ 0 0 rad background color4 /ink] + [ 0 0 rad background color5 /ink] + [ 0 0 rad background color6 /ink] + } for + [-800 0 [ -750 ] /circle] [800 0 [ -750 ] /circle] + [-500 0 [ -400 ] /circle] [500 0 [ -400 ] /circle] + [-300 0 [ -200 ] /circle] [300 0 [ -200 ] /circle] + [-250 0 [ -100 ] /circle] [250 0 [ -100 ] /circle] + }}% +\psMarble(10,10) +\PstLens[LensMagnification=2.5,LensRotation=45,LensSize=2, + LensShadow=false,LensStyleGlass=YellowGlass](1,-1){% +\psMarble(10,10)} +\end{pspicture} +\end{verbatim} +\subsection{Draw contours only} + +\begin{center} +\begin{pspicture}(-5,-6)(5,6) +\psMarble[L=25,viscosity=120,drawcontours, + background=1 1 1, + linewidth=0.1, + actions={ + 49 -1 1 + { + /cnt exch def + [ 0 0 + 700 50 + div dup cnt 1 add mul dup mul exch cnt mul dup mul sub sqrt + [] colors cnt colors length mod get /ink ] + } for + [ 5 0 10 [ -600 150 600 {} for ] /line] + [ 0 -5 [ -600 150 600 {} for ] 0 /line] + [ 1 0 {2 mul sin 25 mul} /wiggle ] }, + colors={ + [0.9 0.87 0.6] + [0.78 0.52 0.72] + [0.1 0.29 0.4] + [0.13 0.5 0.51] + [0.24 0.27 0.6] + [0.43 0.28 0.32] + } + ](10,12) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-5,-6)(5,6) +\psMarble[L=25,viscosity=120,drawcontours, + background=1 1 1, + linewidth=0.1, + actions={ + 49 -1 1 + { + /cnt exch def + [ 0 0 + 700 50 + div dup cnt 1 add mul dup mul exch cnt mul dup mul sub sqrt + [] colors cnt colors length mod get /ink ] + } for + [ 5 0 10 [ -600 150 600 {} for ] /line] + [ 0 -5 [ -600 150 600 {} for ] 0 /line] + [ 1 0 {2 mul sin 25 mul} /wiggle ] }, + colors={ + [0.9 0.87 0.6] + [0.78 0.52 0.72] + [0.1 0.29 0.4] + [0.13 0.5 0.51] + [0.24 0.27 0.6] + [0.43 0.28 0.32] + } + ](10,12) +\end{pspicture} +\end{verbatim} + +\subsection{Ripple\label{ripple}} + +\begin{center} +\begin{pspicture}(-5.5,-8)(5.5,8) +\pstVerb{/ripple 75 def +/riplim ripple 6 mul def}% +\psMarble[L=500,viscosity=25, + actions={ + 11 -1 1 + { + /rad exch sqrt 40 mul def + [ 0 0 rad background color1 /ink] + [ 0 0 rad background color2 /ink] + [ 0 0 rad background color3 /ink] + [ 0 0 rad background color4 /ink] + [ 0 0 rad background color5 /ink] + [ 0 0 rad background color6 /ink] + } for + [ 0 50 /offset] + [ 0 0 [ ripple ripple riplim {} for ] /circle ] + }](11,16) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-5.5,-8)(5.5,8) +\pstVerb{/ripple 75 def +/riplim ripple 6 mul def}% +\psMarble[L=500,viscosity=25, + actions={ + 11 -1 1 + { + /rad exch sqrt 40 mul def + [ 0 0 rad background color1 /ink] + [ 0 0 rad background color2 /ink] + [ 0 0 rad background color3 /ink] + [ 0 0 rad background color4 /ink] + [ 0 0 rad background color5 /ink] + [ 0 0 rad background color6 /ink] + } for + [ 0 50 /offset] + [ 0 0 [ ripple ripple riplim {} for ] /circle ] + }](11,16) +\end{pspicture} +\end{verbatim} + +\subsection{Line-Line-Wiggle} + +\begin{center} +\begin{pspicture*}(-5,-6)(5,6) +\psMarble[L=25,viscosity=120, + actions={ + 49 -1 1 + { + /cnt exch def + [ 0 0 + 700 50 + div dup cnt 1 add mul dup mul exch cnt mul dup mul sub sqrt + [] colors cnt colors length mod get /ink ] + } for + [ 5 0 10 [ -600 150 600 {} for ] /line] + [ 0 -5 [ -600 150 600 {} for ] 0 /line] + [ 1 0 {2 mul sin 25 mul} /wiggle ] }, + colors={ + [0.9 0.87 0.6] + [0.78 0.52 0.72] + [0.1 0.29 0.4] + [0.13 0.5 0.51] + [0.24 0.27 0.6] + [0.43 0.28 0.32] + } + ](10,12) +\end{pspicture*} +\end{center} +\begin{verbatim} +\begin{pspicture*}(-5,-6)(5,6) +\psMarble[L=25,viscosity=120, + actions={ + 49 -1 1 + { + /cnt exch def + [ 0 0 + 700 50 + div dup cnt 1 add mul dup mul exch cnt mul dup mul sub sqrt + [] colors cnt colors length mod get /ink ] + } for + [ 5 0 10 [ -600 150 600 {} for ] /line] + [ 0 -5 [ -600 150 600 {} for ] 0 /line] + [ 1 0 {2 mul sin 25 mul} /wiggle ] }, + colors={ + [0.9 0.87 0.6] + [0.78 0.52 0.72] + [0.1 0.29 0.4] + [0.13 0.5 0.51] + [0.24 0.27 0.6] + [0.43 0.28 0.32] + } + ](10,12) +\end{pspicture*} +\end{verbatim} + +\subsection{Blendmode} + +\begin{center} +\begin{pspicture}(-5,-8)(5,8) +% /Lighten +% http://www.laboiteverte.fr/wp-content/uploads/2015/04/marbrure-papier-marbre-livre-16.jpg +\psMarble[L=100, + background=0 0 0, + actions={ + /Lighten .setblendmode + 200 { + [random:uniform 1000 mul 500 sub % -500 <x<500 + random:uniform 1000 mul 500 sub % -500 <y<500 + 25 background [1 0 0] /ink] + } repeat + /Lighten .setblendmode + 200 { + [random:uniform 1000 mul 500 sub % x + random:uniform 1000 mul 500 sub % y + 30 background [0 1 0] /ink] + } repeat + /Lighten .setblendmode + 100 { + [random:uniform 1000 mul 500 sub % x + random:uniform 1000 mul 500 sub % y + 20 background [0 0 1 ] /ink] + } repeat + [1 0 {5 mul sin 45 mul} /wiggle] + [ 100 200 100 /vortex] + [ -100 -200 100 /vortex]}](10,16) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-5,-8)(5,8) +% /Lighten +% http://www.laboiteverte.fr/wp-content/uploads/2015/04/marbrure-papier-marbre-livre-16.jpg +\psMarble[L=100, + background=0 0 0, + actions={ + /Lighten .setblendmode + 200 { + [random:uniform 1000 mul 500 sub % -500 <x<500 + random:uniform 1000 mul 500 sub % -500 <y<500 + 25 background [1 0 0] /ink] + } repeat + /Lighten .setblendmode + 200 { + [random:uniform 1000 mul 500 sub % x + random:uniform 1000 mul 500 sub % y + 30 background [0 1 0] /ink] + } repeat + /Lighten .setblendmode + 100 { + [random:uniform 1000 mul 500 sub % x + random:uniform 1000 mul 500 sub % y + 20 background [0 0 1 ] /ink] + } repeat + [1 0 {5 mul sin 45 mul} /wiggle] + [ 100 200 100 /vortex] + [ -100 -200 100 /vortex]}](10,16) +\end{pspicture} +\end{verbatim} + +\begin{center} +\begin{pspicture}(-5,-8)(5,8) +% /Darken +% http://www.laboiteverte.fr/wp-content/uploads/2015/04/marbrure-papier-marbre-livre-16.jpg +\psMarble[ + background=1 1 1, + actions={ + /Darken .setblendmode + 100 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 30 background [1 1 0] /ink] + } repeat + /Darken .setblendmode + 100 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 30 background[0 1 1] /ink] + } repeat + /Darken .setblendmode + 50 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 30 background [1 0 1 ] /ink] + } repeat + [ 100 200 20 /vortex] + [ -100 -200 20 /vortex]}](10,16) +\end{pspicture} +\end{center} +\begin{verbatim} +\begin{pspicture}(-5,-8)(5,8) +% /Darken +% http://www.laboiteverte.fr/wp-content/uploads/2015/04/marbrure-papier-marbre-livre-16.jpg +\psMarble[ + background=1 1 1, + actions={ + /Darken .setblendmode + 100 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 30 background [1 1 0] /ink] + } repeat + /Darken .setblendmode + 100 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 30 background[0 1 1] /ink] + } repeat + /Darken .setblendmode + 50 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 30 background [1 0 1 ] /ink] + } repeat + [ 100 200 20 /vortex] + [ -100 -200 20 /vortex]}](10,16) +\end{pspicture} +\end{verbatim} + +\subsection{Transparency} + +\begin{center} +\begin{pspicture}(-6,-8)(6,8) +\psMarble[ + background=1 1 0, + actions={ + 0.25 .setopacityalpha + 100 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 45 [] [1 0 0] /ink] + } repeat + 0.25 .setopacityalpha + 100 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 35 [] [0 1 0] /ink] + } repeat + 0.25 .setopacityalpha + 50 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 25 [] [0 0 1 ] /ink] + } repeat + [100 200 200 /vortex] + }](12,16) +\end{pspicture} +\begin{verbatim} +\begin{pspicture}(-6,-8)(6,8) +\psMarble[ + background=1 1 0, + actions={ + 0.25 .setopacityalpha + 100 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 45 [] [1 0 0] /ink] + } repeat + 0.25 .setopacityalpha + 100 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 35 [] [0 1 0] /ink] + } repeat + 0.25 .setopacityalpha + 50 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 25 [] [0 0 1 ] /ink] + } repeat + [100 200 200 /vortex] + }](12,16) +\end{pspicture} +\end{verbatim} +\end{center} + +\newpage + +\section{List of all optional arguments for \texttt{pst-marble}} + +\xkvview{family=pst-marble,columns={key,type,default}} + +\clearpage + +\nocite{*} +\bgroup +\RaggedRight +\printbibliography +\egroup + +\printindex +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/dvips/pst-marble/pst-marble.pro b/Master/texmf-dist/dvips/pst-marble/pst-marble.pro new file mode 100644 index 00000000000..60a36806480 --- /dev/null +++ b/Master/texmf-dist/dvips/pst-marble/pst-marble.pro @@ -0,0 +1,578 @@ +%%Copyright: 2018 Aubrey Jaffer +%%Creator: Aubrey Jaffer +%%For: Voluntocracy +%%CreationDate: 2018-09-13 +/plotdict 70 dict def +plotdict begin + +/pi 3.141592653589793 def +/e 2.718281828459045 def + + +%% depend on rendering direction: +%/zsgn 0 def + +/URL (http://people.csail.mit.edu/jaffer/Marbling) def + +% negative L for (raster) reverse-marbling +/marble % viscosity L +{ + /z exch def /visc exch def + /u 2.0 -1 visc div exp def + /L z abs def + /reverse-rendering? z 0 lt def + /z.2.pi z 180 pi div mul def + /zsgn 1 z 0 lt {neg} if def +% 0 setlinewidth + reverse-rendering? + { + matrix currentmatrix aload pop 6 {round 6 1 roll} repeat + matrix astore setmatrix newpath + } if +% clippath pathbbox /hiy exch round cvi def /hix exch round cvi def +% /loy exch round cvi def /lox exch round cvi def + reverse-rendering? not {background aload pop setrgbcolor fill} if + /scl hiy loy sub hix lox sub max def +% /orgx hix lox add 2 div def +% /orgy hiy loy add 2 div def +% set background field of each /ink + 0 1 acnt -1 add + { + /sdx exch def + actions sdx get aload pop /ct exch def + ct /ink eq + { + pop pop pop /cy exch def /cx exch def + cx cy sdx find-ink-background /bgc exch def + actions sdx get 3 bgc put + } + { + ct /line eq + {pop pop pop pop} + { + ct /stroke eq + {pop pop pop pop pop} + { + ct /circle eq ct /vortex eq or + {pop pop pop} + { + ct /wiggle eq + {pop pop pop} + { + ct /offset eq + {pop pop} + {(unrecognized token) = ct =} + } ifelse + } ifelse + } ifelse + } ifelse + } ifelse + } for + reverse-rendering? + { + do-raster + } + { +% orgx orgy translate + scl 1000. div dup scale + do-inks + } ifelse +} bind def + +%% Given x, y coordinates and index of /ink on stack, returns the rgb +%% vector of the ink immediately surrounding that ink. +/find-ink-background +{ + /cdx exch -1 add def + { + cdx 0 lt {pop pop background exit} if + actions cdx get aload pop /ct exch def + ct /ink eq + % movement due to ink-drop. + { % px py cx cy rad rgb + /rgb exch def + pop % /bgc exch def + /rad^2 exch dup mul def + /cy exch def /cx exch def /py exch def /px exch def + /a^2 px cx sub dup mul py cy sub dup mul add def + a^2 1e-10 lt {0.} {1. rad^2 a^2 div sub} ifelse + /disc exch def + disc 0. le + {rgb exit} + { + /a disc sqrt def + px cx sub a mul cx add + py cy sub a mul cy add + } ifelse + } + { + ct /line eq + {line-deformation} + { + ct /circle eq + {circle-deformation} + { + ct /vortex eq + {vortex-deformation} + { + ct /wiggle eq + {wiggle} + {offset} ifelse + } ifelse + } ifelse + } ifelse + } ifelse + /cdx cdx -1 add def + } loop +} bind def + +/offset % px py dx dy --> px py +{ + /dy exch def /dx exch def + dy reverse-rendering? {neg} if add exch + dx reverse-rendering? {neg} if add exch +} bind def + +/wiggle % px py dx dy {func} --> px py +{ + /func exch def + /dy exch def /dx exch def + /py exch def /px exch def + /a py dx mul px dy mul sub func exec reverse-rendering? {neg} if def + px dx a mul add py dy a mul add +} bind def + +/stroke-deformation % px py bx by ex ey wid --> px py +{ + /wid exch def + reverse-rendering? { 4 2 roll } if + /ey exch def /ex exch def + /by exch def /bx exch def + /py exch def /px exch def + /tU ex bx sub dup mul ey by sub dup mul add sqrt def + tU 1e-3 le + {} + { + /nx ex bx sub tU div def + /ny ey by sub tU div def + /rpts tU Q mul wid div ceiling cvi def + /stpx ex bx sub rpts div def + /stpy ey by sub rpts div def + /ex bx stpx add def + /ey by stpy add def + /tU tU rpts div def + /inx 0 def + /iny 0 def + 1 1 rpts + { + pop + /dxB bx px sub def + /dyB by py sub 1e-12 add def + /dxE ex px sub def + /dyE ey by add 2 div py sub 1e-12 add def + /r dxB dup mul dyB dup mul add sqrt def + /s dxE dup mul dyE dup mul add sqrt def + /txB dxB nx mul dyB ny mul add def + /txE dxE nx mul dyE ny mul add def + /ty dxB ny mul dyB nx mul sub def + /denr e r wid div exp r mul wid mul 2 mul def + /dens e s wid div exp s mul wid mul 2 mul def + /inx r wid mul ty dup mul sub tU mul denr div + s wid mul ty dup mul sub tU mul dens div add def + /iny txB ty mul tU mul denr div + txE ty mul tU mul dens div add def + /px px inx nx mul iny ny mul add add def + /py py inx ny mul iny nx mul sub add def + /bx ex def + /by ey def + /ex ex stpx add def + /ey ey stpy add def + } for + } ifelse + px py +} bind def + +/line-deformation % px py dx dy xs ys --> px py +{ + /ys exch def /xs exch def + /dy exch def /dx exch def + /py exch def /px exch def + /a 0 def + ys type /arraytype eq + { + /px-xf*dy px xs sub dy mul def + ys { + py sub dx mul px-xf*dy add abs u exch exp z mul a add /a exch def + } forall + } + { + /py-yf*dx py ys sub dx mul def + xs { + px sub dy mul py-yf*dx add abs u exch exp z mul a add /a exch def + } forall + } ifelse + px dx a mul add py dy a mul add +} bind def + +/circle-deformation % px py cx cy rs --> px py +{ + /rs exch def + /cy exch def /cx exch def + /py exch def /px exch def + /p-c px cx sub dup mul py cy sub dup mul add sqrt def + /a 0 def + rs { + /r exch def /a p-c r abs sub abs u exch exp z.2.pi mul p-c div + r 0 lt {neg} if + a add def + } forall + px cx sub py cy sub + [ a dup cos exch sin 2 copy neg exch cx cy ] transform +} bind def + +% Acutally an irrotational vortex. rad is radius with 360 deg rotation. +/vortex-deformation % px py cx cy rad --> px py +{ + /rad exch def + /cy exch def /cx exch def + /py exch def /px exch def + /p-c px cx sub dup mul py cy sub dup mul add sqrt def + /a p-c 1e-3 lt {0} {rad p-c div pi div 180 mul} ifelse reverse-rendering? {neg} if def + px cx sub py cy sub + [ a dup cos exch sin 2 copy neg exch cx cy ] transform +} bind def + +%% Functions used for forward rendering: + +% movement due to ink-drop. +/spread % px py cx cy rad +{ + /rad exch def /cy exch def /cx exch def /py exch def /px exch def + /p-c^2 px cx sub dup mul py cy sub dup mul add def + /a rad dup mul p-c^2 div 1 add sqrt def + py cy sub px cx sub a mul cx add exch a mul cy add +} bind def + +%% Given x, y coordinates on stack, calculates movement due to +%% subsequent operations. +/composite-map +{ + idx 1 add 1 acnt -1 add + { + actions exch get aload pop /ct exch def + ct /ink eq + {pop pop spread} % pop rgb-vectors + { + ct /line eq + {line-deformation} + { + ct /stroke eq + {stroke-deformation} + { + ct /circle eq + {circle-deformation} + { + ct /vortex eq + {vortex-deformation} + { + ct /wiggle eq + {wiggle} + {offset} ifelse + } ifelse + } ifelse + } ifelse + } ifelse + } ifelse + } for +} bind def + +% Given x, y coordinates on stack and eps < 2, leaves x, y on stack +% for next point on the circle centered at origin. +/Minsky-circle +{ + dup 3 1 roll eps mul sub dup eps mul 3 2 roll add +} bind def + +% Draws and fills circle as distorted by composite-map +/do-action +{ + Ir Cx add Cy composite-map moveto + Ir 0 + { + dup /oy exch def + Minsky-circle 2 copy + exch Cx add exch Cy add % shift center of ink + composite-map lineto + dup 0 gt oy 0 lt and {exit} if + } loop + pop pop + closepath Contours +} bind def + +% Fills (distorted) circles. +/do-inks % acnt = index of last action + 1 +{ + 0 1 acnt -1 add + { + /idx exch def + actions idx get aload pop /act exch def + /ink act eq + { + aload pop setrgbcolor pop + /Ir exch def /Cy exch def /Cx exch def + /eps 10 scl sqrt div Ir div acnt idx sub 1 add log div def + do-action + } if + } for +} bind def + +%% Functions used for reverse-rendering: + +/Vmap1 % v1 proc +{ + /proc exch def + /v1 exch def + [ v1 + { + proc exec + } forall + ] +} bind def + +/Vmap2 % v1 v2 proc +{ + /proc exch def + /v2 exch def + /idx 0 def + /res v2 length array def + { + res exch idx exch v2 idx get proc exec put + /idx idx 1 add def + } forall + res +} bind def + +/shade % v[3] pwr +{ + /pwr exch def + {dup 1e-30 lt {} {pwr exp} ifelse} Vmap1 +} bind def + +/sharpen % 0<=x<=1 +{ + .5 sub dup abs 0.00001 lt {} {dup abs .66 exp div .63 mul} ifelse + .5 add +} bind def + +%% Given x, y coordinates on stack, calculates the rgb vector +%% acnt is index +1 of last operation. +/actions2rgb +{ + /cdx acnt -1 add def + { + actions cdx get aload pop /ct exch def + ct /ink eq + % movement due to ink-drop. + { % px py cx cy rad^2 rgb + /rgb exch def + /bgc exch def + /rad^2 exch dup mul def + /cy exch def /cx exch def /py exch def /px exch def + /a^2 px cx sub dup mul py cy sub dup mul add def + a^2 .0000001 lt {0.} {1. rad^2 a^2 div sub} ifelse + /disc exch def + disc 0. le + { + disc -1 le + {rgb} + { + /a disc neg sqrt sharpen def + rgb bgc {1 a sub mul exch a mul add} Vmap2} + ifelse + exit + } + { + /a disc sqrt def + px cx sub a mul cx add + py cy sub a mul cy add + } ifelse + } + { + ct /line eq + {line-deformation} + { + ct /stroke eq + {stroke-deformation} + { + ct /circle eq + {circle-deformation} + { + ct /vortex eq + {vortex-deformation} + { + ct /wiggle eq + {wiggle} + {offset} ifelse + } ifelse + } ifelse + } ifelse + } ifelse + } ifelse + /cdx cdx -1 add def + cdx 0 lt {pop pop background exit} if + } loop +} bind def + +/do-raster +{ + loy resolution hiy + { + /iy exch def + /fy iy orgy sub scl div 1000. mul def + lox resolution hix + { + /ix exch def + /fx ix orgx sub scl div 1000. mul def + fx fy actions2rgb + % color modifications + % fy dup mul fx dup mul add sqrt dup + % riplim lt + % {180. ripple div mul sin abs .75 mul 1 exch sub shade} + % {pop} + % ifelse + % end color modifications + aload pop setrgbcolor + ix iy resolution dup rectfill + } for + } for +} bind def + +%% Controls and Design: + +% Returns number between 0. and 1. +/random:uniform +{ + rand 2147483647. div +} bind def + +% Dimensions are relative to a 1000 x 1000 square with the origin +% at its center. + +% colors are red, green, and blue components between 0 and 1. +%/background [ 1 1 1 ] bind def + +% Cx Cy Ir bgc-vector rgb-vector /ink +% dx dy xs ys /line +% cx cy rs /circle + +/color1 [0.960 0.764 0.576] bind def +/color2 [0.316 0.362 0.298] bind def +/color3 [0.200 0.050 0.015] bind def +/color4 [0.023 0.145 0.451] bind def +/color5 [0.866 0.353 0.050] bind def +/color6 [0.200 0.050 0.015] bind def + +/Q 1 def +%/zsgn 1 raster-rendering? {neg} if def +%/jdx raster-rendering? {2} {0} ifelse def +% cx, cy center coordinates +% dx, dy unit direction vector; dl length of displacement +% bx, by begin coordinates; ex, ey end corrdinates + +% [ cx cy Ir bgc-vector rgb-vector /ink ] +% [ dx dy {func} /wiggle ] +% [ bx by ex ey /stroke ] +% [ dx dy xs ys /line ] +% [ cx cy [ rs ] /circle ] +% [ cx cy rad /vortex ] +% [ dx dy /offset ] +%%----Examples----%% +/concentric-bands { +% This section creates even thickness concentric bands + 32 -1 add -1 0 + { + /cnt exch def + [ 0 0 + 750 32 + div dup cnt 1 add mul dup mul exch cnt mul dup mul sub sqrt + background colors cnt colors length mod get /ink ] + } for +} def + + +/strokeinks-circle { + -100 50 500 + { /idx exch def + [ -270 idx sub -300 idx 2 mul add [ 200 idx 3 mul add ] /circle ] + } for + } def +/color1 [0.960 0.764 0.576] bind def +/color2 [0.316 0.362 0.298] bind def +/color3 [0.200 0.050 0.015] bind def +/color4 [0.023 0.145 0.451] bind def +/color5 [0.866 0.353 0.050] bind def +/color6 [0.200 0.050 0.015] bind def + +/drops { + 100 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 30 background [0.960 0.764 0.576] /ink] + } repeat + 100 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 30 background [0.270 0.035 0.058] /ink] + } repeat + 50 { + [random:uniform pagewidth mul 1.5 mul pagewidth -2 div 1.5 mul round add % x + random:uniform pageheight mul 1.5 mul pageheight -2 div 1.5 mul round add % y + 30 background [0.866 0.353 0.000 ] /ink] + } repeat +% [ 0 5 [ -800 100 800 {} for ] 0 /line] +} def + +% macros de pst-solides3d +% de Jean-Paul Vignault +%%%%% ### defpoint ### +%% syntaxe : xA yA /A defpoint +/defpoint { +1 dict begin + /t@mp@r@ire exch def + [ 3 1 roll ] cvx t@mp@r@ire exch +end def +} def + +%%%%% ### norme ### +%% syntaxe : u norme --> |u| +/norme { + dup mul + exch + dup mul + add sqrt +} def + +%%%%% ### mulv ### +%% syntaxe : u a mulv --> au +/mulv { %% xA, yA, a + dup %% xA, yA, a, a + 3 1 roll %% xA, a, yA, a + mul 3 1 roll %% ayA, xA, a + mul exch +} def + +%%%%% ### normalize ### +%% syntaxe : u normalize -> u / ||u|| +/normalize { +2 dict begin + /u defpoint + /n u norme def + u 1 n div mulv +end +} def +end + + + + + diff --git a/Master/texmf-dist/tex/generic/pst-marble/pst-marble.tex b/Master/texmf-dist/tex/generic/pst-marble/pst-marble.tex new file mode 100644 index 00000000000..a4d254cd9f9 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pst-marble/pst-marble.tex @@ -0,0 +1,95 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% This is file `pst-marble.tex' %% +%% %% +%% IMPORTANT NOTICE: %% +%% %% +%% Package `pst-marble' %% +%% %% +%% Aubrey Jaffers, with help of Manuel Luque, Jürgen Gilg %% +%% Email address: agj@alum.mit.edu %% +%% %% +%% This program can redistributed and/or modified under %% +%% the terms of the LaTeX Project Public License %% +%% Distributed from CTAN archives in directory %% +%% macros/latex/base/lppl.txt; either version 1.3c of %% +%% the License, or (at your option) any later version. %% +%% %% +%% DESCRIPTION: %% +%% `pst-marble' is a PSTricks package to draw marble-like patterns %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\csname PSTMARBLELoaded\endcsname +\let \PSTMARBLELoaded\endinput +\ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi +\ifx\PSTXKeyLoaded\endinput \else\input pst-xkey.tex\fi +\def\fileversion{0.1} +\def\filedate{2018/09/23} +\message{`PST' v\fileversion, \filedate} +% +\pstheader{pst-marble.pro} +% +\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax +\pst@addfams{pst-marble} +\define@key[psset]{pst-marble}{background}{\def\pst@marble@background{#1 }} +\define@key[psset]{pst-marble}{viscosity}{\def\pst@marble@visc{#1 }} +% characteristic length +\define@key[psset]{pst-marble}{L}{\def\pst@marble@L{#1 }} % +\define@key[psset]{pst-marble}{resolution}{\def\pst@marble@resolution{#1 }} % +\define@key[psset]{pst-marble}{actions}{\def\pst@marble@actions{#1 }} +% colors are red, green, and blue components between 0 and 1. +\define@key[psset]{pst-marble}{colors}{\def\pst@marble@colors{#1 }} +\define@boolkey[psset]{pst-marble}[Pst@]{drawcontours}[true]{} +\psset[pst-marble]{background=0 0 0, + viscosity=25, + L=200, + resolution=1, + actions=concentric-bands, + colors={ + [0.376 0.357 0.451] + [0.255 0.259 0.341] + [0.306 0.498 0.62 ] + [0.686 0.741 0.851] + [0.353 0.529 0.627]}, + drawcontours=false + }% +\def\psMarble{\def\pst@par{}\pst@object{psMarble}} +\def\psMarble@i{\@ifnextchar({\psMarble@ii}{\psMarble@ii(10,10)}} +\def\psMarble@ii(#1,#2){% +\begin@SpecialObj +\addto@pscode{% +/cm {\pst@number\psunit mul } bind def +/background [\pst@marble@background] def +/resolution \pst@marble@resolution def +/colors [\pst@marble@colors] def +/pagewidth #1 cm def % en cm +/pageheight #2 cm def % en cm +% clippath pathbbox +%/hiy exch round cvi def /hix exch round cvi def +%/loy exch round cvi def /lox exch round cvi def +plotdict begin +/loy pageheight -2 div def +/hiy pageheight 2 div def +/hix pagewidth 2 div def +/lox pagewidth -2 div def +/orgx hix lox add 2 div def +/orgy hiy loy add 2 div def +orgx orgy translate +/actions [\pst@marble@actions] def +/acnt actions length def +\ifPst@drawcontours /Contours {stroke} def \else /Contours {fill} def \fi +gsave + background aload pop setrgbcolor + lox loy pagewidth pageheight rectfill +grestore +gsave + lox loy pagewidth pageheight rectclip + \pst@marble@visc \pst@marble@L marble +grestore +end + }% fin du code ps + \end@SpecialObj + }% % fin de la commande PSTricks +\catcode`\@=\PstAtCode\relax +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/pst-marble/pst-marble.sty b/Master/texmf-dist/tex/latex/pst-marble/pst-marble.sty new file mode 100644 index 00000000000..af463fa277c --- /dev/null +++ b/Master/texmf-dist/tex/latex/pst-marble/pst-marble.sty @@ -0,0 +1,33 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% %% +%% This is file `pst-marble.sty' %% +%% %% +%% IMPORTANT NOTICE: %% +%% %% +%% Package `pst-marble' %% +%% %% +%% Aubrey Jaffers, with help of Manuel Luque, Jürgen Gilg %% +%% Email address: agj@alum.mit.edu %% +%% %% +%% This program can redistributed and/or modified under %% +%% the terms of the LaTeX Project Public License %% +%% Distributed from CTAN archives in directory %% +%% macros/latex/base/lppl.txt; either version 1.3c of %% +%% the License, or (at your option) any later version. %% +%% %% +%% DESCRIPTION: %% +%% `pst-marble' is a PSTricks package to draw marble-like patterns %% +%% %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\RequirePackage{pstricks} +\ProvidesPackage{pst-marble}[2018/09/23 package wrapper for PSTricks pst-marble.tex] +\input pst-marble.tex +\ProvidesFile{pst-marble.tex} + [\filedate\space v\fileversion\space `PST-marble'] + +\IfFileExists{pst-marble.pro}{% + \ProvidesFile{pst-marble.pro} + [2018/09/23 v. 0.1, PostScript prologue file ] +\@addtofilelist{pst-marble.pro}}{}% +\endinput |