diff options
author | Karl Berry <karl@freefriends.org> | 2018-10-19 20:34:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-10-19 20:34:34 +0000 |
commit | c571740f80243b351c79c03e688258e374a4c110 (patch) | |
tree | a44b19d32109e3c38c759a5d76d5d26be9aea68a | |
parent | 2fc43b1bd746c45eaf2fdc043547f2f3a1bb16ca (diff) |
pst-marble (19oct18)
git-svn-id: svn://tug.org/texlive/trunk@48942 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-marble/CHANGES.md | 134 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-marble/README.md | 46 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-marble/pst-marble-doc.pdf | bin | 16419314 -> 22833647 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/pst-marble/pst-marble-doc.tex | 2982 | ||||
-rw-r--r-- | Master/texmf-dist/dvips/pst-marble/pst-marble.pro | 483 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/pst-marble/pst-marble.tex | 44 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/pst-marble/pst-marble.sty | 5 |
7 files changed, 2304 insertions, 1390 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-marble/CHANGES.md b/Master/texmf-dist/doc/generic/pst-marble/CHANGES.md new file mode 100644 index 00000000000..b041285cf3c --- /dev/null +++ b/Master/texmf-dist/doc/generic/pst-marble/CHANGES.md @@ -0,0 +1,134 @@ +# **CHANGES** # +# pst-marble v. 1.0 # +# 2018/10/19 # + + Source: pst-marble.tex, pst-marble.sty, pst-marble.pro + Author: Aubrey Jaffer + Maintainers: Jürgen Gilg, Manuel Luque + Info: Draw marble-like pattern with PSTricks + License: LPPL 1.3c + +--- + +## Changes in v. 1.0: + +## Complete reorganization of the basic deformation commands + +We reorganized the marbling primitives to have consistent units +which model a 1 m by 1 m region of a much larger tank. All lengths are +in mm, velocities (in mm/s), angles (in degrees), angular velocity (in +degrees/s), and viscosity and circulation (in mm^2/s). + +For a convex stylus or tine, **D** (in mm) is the ratio of its submerged +volume to its wetted surface area. For a long cylinder it is diameter. + +The deformations take a single argument, **viscosity** (in mm^2/s), which is also +viscosity relative to 20 °C water. Negative viscosity specifies +(raster) reverse-marbling. + +## /drop + +**\[ cx cy radinc \[ bgc \] \[ rgb \] /drop \]** + +Replaces **/ink**; works as before. + +## /offset ## + +**\[ dx dy /offset \]** + +As before. Maybe should be changed to take angle and length. + +## /stir + +**\[ cx cy \[ r \] w th D /stir \]** + +replaces **/circle**. Tines follow concentric circular tracks. + + cx, cy Center coordinates in mm + [ r ] List of radii in mm + w Angular velocity + th Displacement at tines + D Tine diameter + +## /vortex + +**\[ cx cy circ t /vortex \]** + +Models a **Lamb-Oseen** vortex. + + cx, cy Center coordinates in mm + circ Circulation (in mm^2/s) is a simple scale factor. + Typical value: 30e3 mm^2/s. + t Time after circulation impulse at center. As t gets very large, + the whole surface returns to its original pattern, possibly with rigid + rotation. Typical value 10 s. + +## /stroke + +**\[ bx by ex ey V D /stroke \]** + +As before; short stroke. + + bx, by Beginning of stroke + ex, ey End of stroke + V Stylus velocity in mm/s + D Stylus diameter in mm. Make larger to affect paint farther away. + +## /rake + +**\[ angle \[ r \] V tU D /rake \]** + +replaces **/line**. Draws a stylus or parallel stylii across the tank. + + angle Angle from y-axis in degrees; 0 is up. + [ r ] List of distances from center of image (0,0). + V Stylus velocity in mm/s + tU Distance points on the stylus track are moved. + D Stylus diameter in mm. Make larger to affect paint farther away. + +## /wiggle + +**\[ angle {func} /wiggle \]** + +Parameters changed. + + angle Wiggle will be perpendicular to angle from y-axis up. + {func} Input is distance in mm; output is wiggle displacement in mm. + +## NEW ACTIONS + +## random-drops + +**\[ size \[ color \] count random-drops \]** + + count Number of the drops + size Size of the drops + color Color of the drops + +## random-drops-colors + +**\[ size count random-drops-colors \]** + + count Number of the drops + size Size of the drops + +## concentric-bands + +**\[ cx cy RadiusIncrement NumberOfBands concentric-bands \]** + + cx, cy Center coordinates + RadiusIncrement Multiplication coefficient between the bands + NumberOfBands Number of the elements within + the [array of colors] list + [array of colors]: this is the list of colors + within the colors= key + + +## ADDITIONAL HINTS + +Having stylus diameter, velocity, and viscosity as parameters means +this system has an extra degree of freedom. If you want to reduce the +width of the affected region of a rake by a factor of 10, either +reduce **V** by a factor of 10 or reduce **D** by a factor of 3.1 (sqrt 10). + + diff --git a/Master/texmf-dist/doc/generic/pst-marble/README.md b/Master/texmf-dist/doc/generic/pst-marble/README.md index 77e492e98d1..bd9551024dd 100644 --- a/Master/texmf-dist/doc/generic/pst-marble/README.md +++ b/Master/texmf-dist/doc/generic/pst-marble/README.md @@ -1,9 +1,39 @@ -% 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 +# **README** # +# pst-marble v. 1.0 # +# 2018/10/19 # + + Source: pst-marble.tex, pst-marble.sty, pst-marble.pro + Author: Aubrey Jaffer + Maintainers: Jürgen Gilg, Manuel Luque + Info: Draw marble-like pattern with PSTricks + License: LPPL 1.3c + +--- + +# Short description # + +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. + +The package comes with some predefined *basic actions* like: + +- /drop +- random-drops +- random-drops-colors +- concentric-bands +- /stroke +- /rake +- /stir +- /vortex +- /wiggle +- /offset + +With these commands one can create quite artistic marble-like patterns following +the rules of fluid mechanics. + 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 differindex e64da7abba2..bb132151b49 100644 --- a/Master/texmf-dist/doc/generic/pst-marble/pst-marble-doc.pdf +++ 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 index 2a9027355e8..81558b32453 100644 --- a/Master/texmf-dist/doc/generic/pst-marble/pst-marble-doc.tex +++ b/Master/texmf-dist/doc/generic/pst-marble/pst-marble-doc.tex @@ -6,8 +6,9 @@ %% %% %% Package `pst-marble' %% %% %% -%% Aubrey Jaffers, with help of Manuel Luque, Jürgen Gilg %% +%% Aubrey Jaffer with the help of Jürgen Gilg and Manuel Luque %% %% Email address: agj@alum.mit.edu %% +%% Copyright (C) 2018 Aubrey Jaffer %% %% %% %% This program can redistributed and/or modified under %% %% the terms of the LaTeX Project Public License %% @@ -49,134 +50,212 @@ \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} +\title{pst-marble v 1.0} \subtitle{A PSTricks package to draw marble-like patterns} \author{% Aubrey \textsc{Jaffer}\\ with the help of\\ - Manuel \textsc{Luque}\\ - Jürgen \textsc{Gilg} + Jürgen \textsc{Gilg}\\ + Manuel \textsc{Luque} } -\date{\today} +\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/} +\begin{abstract}\parskip4pt\parindent0pt + +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 paint marbling is that while rakings across the tank stretch and deform the paint 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. + +\begin{center} +\begin{pspicture}(-7,-5)(5,5) +\psMarble[viscosity=1000,background=0.9 0.9 0.9, + colors={[0.176 0.353 0.129][0.635 0.008 0.094][0.078 0.165 0.518] + [0.824 0.592 0.031][0.059 0.522 0.392][0.816 0.333 0.475]}, + actions={% + 0 0 40 6 concentric-bands + [ 0 0 20 background color1 /drop] + [ 0 240 /offset] + [ 180 [ -460 60 460 {} for ] 40 200 31 /rake] + [ 90 {0.75 mul sin -120 mul} /wiggle] + [ 180 [-750 -150 450] 40 200 31 /rake ] + [ 90 {0.75 mul sin 240 mul} /wiggle ] + [ 180 [-450 150 750] 40 200 31 /rake ] + [ 90 {0.75 mul sin -120 mul} /wiggle ] + }](10,10) +\psframe(-7,-5)(5,5) +\rput{90}(-6,0){\parbox{10cm}{\centering\bf\Large Marbling effects by Aubrey Jaffer\\ and PSTricks}} +\end{pspicture} +\end{center} +{\tiny\begin{verbatim} +\begin{pspicture}(-7,-5)(5,5) +\psMarble[viscosity=1000,background=0.9 0.9 0.9, + colors={[0.176 0.353 0.129][0.635 0.008 0.094][0.078 0.165 0.518] + [0.824 0.592 0.031][0.059 0.522 0.392][0.816 0.333 0.475]}, + actions={% + 0 0 40 6 concentric-bands + [ 0 0 20 background color1 /drop] + [ 0 240 /offset] + [ 180 [ -460 60 460 {} for ] 40 200 31 /rake] + [ 90 {0.75 mul sin -120 mul} /wiggle] + [ 180 [-750 -150 450] 40 200 31 /rake ] + [ 90 {0.75 mul sin 240 mul} /wiggle ] + [ 180 [-450 150 750] 40 200 31 /rake ] + [ 90 {0.75 mul sin -120 mul} /wiggle ] + }](10,10) +\psframe(-7,-5)(5,5) +\rput{90}(-6,0){\parbox{10cm}{\centering\bf\Large Marbling effects by Aubrey Jaffer\\ and PSTricks}} +\end{pspicture} +\end{verbatim}} + + +\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.} +\end{abstract} + + +\clearpage -You can see a swirl in a marbled paper on wikipedia: +\section{Introduction} + +Aubrey Jaffer finds a similarity between whirlwinds in the great spot of jupiter and those that appear in some marbled papers. +\begin{center} +\url{http://voluntocracy.blogspot.com/2018/08/} +\end{center} +You can see a swirl on a marbled paper at Wikipedia: +\begin{center} \url{https://fr.wikipedia.org/wiki/Papier_marbr%C3%A9#/media/File:PaperMarbling003France1880Detail.jpg} +\end{center} 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: - +Aubrey Jaffer's article on the physical and mathematical interpretation of the formation of various types of marbling: +\begin{center} \url{https://arxiv.org/abs/1702.02106} +\end{center} +Aubrey Jaffer has improved the model shown in the previous version of \texttt{pst-marble}. Now it is closer to reality and more consistent in the choice of units. This version allows to perform more accurate simulations, however with some new parameters, which will be explained. -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. +But then everything will depend on your patience, your talent so that we can exclaim looking at one of your achievements: +\begin{quote}\itshape +``Beautiful, it's a big piece of art that you have done!'' +\end{quote} +Many articles deal with marbled paper techniques which are used to adorn bindings and book covers. -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. +Here a link to an article devoted to it by the famous \emph{Encyclopaedia of Diderot and D'Alembert}. +\begin{center} +\url{https://fr.wikisource.org/wiki/L%E2%80%99Encyclop%C3%A9die/1re_%C3%A9dition/MARBREUR_DE_PAPIER} +\end{center} -\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} +Aubrey Jaffer and some computer scientists working with him or on their own, tried to understand and model marblings that appear when the artist uses a stylus which he moves the tip on a surface of liquid. As a result in its wake, the drops it encounters get deformed and will also influence the shape of their neighbors according to the properties of the medium (viscosity), the speed of the movement of the stylus, and the nature of its trajectory: line segment, line crossing the whole tank, bow on a circle, ripples, swirls, etc. -\clearpage +The artist can also use a comb (rake) whose spacing between teeth can be adjusted to make more complex figures. These studies follow the laws of fluid mechanics to model and thus be able to create realistic simulations of marbling. -\section{Theory of marbling by Aubrey Jaffer} +On Aubrey Jaffer's website, we'll find many links concerning the theoretical studies. +\begin{center} +\url{http://people.csail.mit.edu/jaffer/Marbling/} +\end{center} +Compared to the previous version, Aubrey Jaffer has reviewed some parameters: -\url{https://www.computer.org/csdl/mags/cg/2012/06/mcg2012060026-abs.html} +\texttt{/vortex} now models a Lamb-Oseen vortex. We'll refer to the article he wrote to study the theory: +\begin{center} +\url{http://people.csail.mit.edu/jaffer/Marbling/vortex.pdf} +\end{center} +The documentation illustrates the parameters that are now used: -\url{https://www.computer.org/csdl/mags/cg/2017/02/mcg2017020090.html} +Center coordinates in mm, circulation in $\mathrm{mm^2/s}$ and time in s. -\url{https://arxiv.org/pdf/1702.02106} +The primitive \texttt{/line} has now become \texttt{/rake} and allows to represent the obtained image when the artist equips himself with a comb (rake) comprising a certain number of identical teeth of a given diameter. He places the comb perpendicularly to a direction fixed by the angle made with the $Oy$-axis (the angle is positive clockwise) and moves it with a speed of (\texttt{V}) along the indicated direction or contrary to it, depending on the sign of the parameter \texttt{tU}. The positions of the teeth are fixed by the distances (in mm) indicated within the list [between the brackets]---the comb/rake can also comprise only one tooth. +By default, the tank's dimensions are 1 m $\times$ 1 m. The scaling factor of the image is 0.1. All lengths are in mm, velocities (in mm/s), angles (in degrees), angular velocity (in degrees/s), and viscosity and circulation (in $\mathrm{mm^2/s}$). -\subsection{Introduction} +For a convex stylus (or tine), \texttt{D} (in mm) is the ratio of its submerged volume to its wetted surface area. For a long cylinder it is its diameter. -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. +Aubrey Jaffer retains 1 global parameter: the dynamic viscosity, see in particular the document ``Oseen Flow in Paint Marbling'': +\begin{center} +\url{https://arxiv.org/abs/1702.02106} +\end{center} +There are 10 types of actions defined and ready to use: +\begin{verbatim} + /drop + random-drops + random-drops-colors + concentric-bands + /rake + /stroke + /stir + /vortex + /wiggle + /offset +\end{verbatim} +They make it possible to create a very large variety of marblings with combinations of the various actions. + +Initially there are drops of colors that the artist spreads with a brush on the surface (a bit of a hazard, even if they are located in a given region) and whose size depends on the brush. He performs the operation several times with other colors and also brushes of different sizes. These single drops, circular in shape, are placed with the following command +\begin{verbatim} + cx cy r [bgc] [rgb] + [ 0 0 100 [] [0 0 1] /drop] +\end{verbatim} +Note, that the coordinates (\texttt{cx, cy}) of the center of the drop and its radius \texttt{r} are in points, the colors need to be setup in the rgb-color-system: (values between 0 and 1). Details are given in the following sections. So this is the first phase: arrange the drops on the surface in several stages with different radii and colors. To facilitate the experimentation of different types of actions, Aubrey Jaffer imagined an initial background obtained by dropping (one after the other) drops of different colors (we can also differentiate their radii) at the same point, they all have the same center, we then obtain an initial background consisting of concentric rings, named ``concentric-bands''. + +Aubrey Jaffer coded all the possible simulations with the expected deformations (rake, stroke, stir, wiggle, vortex) in pure PostScript and his new code, perfectly structured, and whose use is very simple, would be enough to itself, if it weren't necessary for each test, to add lines, delete others, save them within the original PostScript file \ldots + +Therefore, Manuel Luque and Jürgen Gilg have decided to adapt that into PSTricks (with the agreement of Aubey Jaffer). A \verb+\psMarble+ command to switch easily between the different types of actions and add a global viscosity parameter to the PostScript code. There are two ways to calculate and represent the drops. +\begin{itemize} +\item We are interested only in their contour whose transformation is calculated after each addition of a new drop and whose interior is colored with its color (each drop retains its color); +\item in the second case we consider the surface as a grid of points (square pixels of side 1 pt) and each drop is represented by the points situated between its edges. +\end{itemize} +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 a negative value for the viscosity. + +The documentation contains, of course, some more other information than within this short introduction and is likely to be reworked and completed as well as the code. -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} +\subsection{Drop paint} -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: +The first drop of paint 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 on the border of the 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, +\psMarble[viscosity=120,drawcontours,linewidth=0.2, background=1 1 1, actions={ - [ 0 0 100 [] [0 0 1] /ink] + [ 0 0 100 [] [0 0 1] /drop] } ](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, +\psMarble[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] + [ 0 0 200 [] [0 0 1] /drop] + [ 0 0 150 [] [1 0 0] /drop] } ](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, +\psMarble[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] + [ 0 0 200 [] [0 0 1] /drop] + [ 0 0 150 [] [1 0 0] /drop] } ](4,4) \psgrid[subgriddiv=0,gridcolor=red!30,subgridcolor=green,gridlabels=0pt,griddots=10] @@ -184,36 +263,34 @@ If we take 2 drops of different colors, this gives: \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] + cx cy r r g b + [ 0 0 100 [] [0 0 1] /drop] \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: +When we place the second drop of radius $r$ at the point $C(cx,cy)$, 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, +\psMarble[viscosity=120, background=1 1 1, actions={ - [ 0 0 150 [] [0 0 1] /ink] + [ 0 0 150 [] [0 0 1] /drop] } ](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, +\psMarble[viscosity=120, background=1 1 1, actions={ - [ 0 0 150 [] [0 0 1] /ink] - [ -250 0 150 [] [1 0 0] /ink] + [ 0 0 150 [] [0 0 1] /drop] + [ -250 0 150 [] [1 0 0] /drop] } ](4,4) \rput(0,0){\white 1} @@ -224,23 +301,21 @@ $P(x,y)$ is a point of the first drop and $P'(x',y')$ the transformed point. 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, +\psMarble[viscosity=120, background=1 1 1, actions={ - [ 0 0 150 [] [0 0 1] /ink] + [ 0 0 150 [] [0 0 1] /drop] } ](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, +\psMarble[viscosity=120, background=1 1 1, actions={ - [ 0 0 150 [] [0 0 1] /ink] - [ -250 0 150 [] [1 0 0] /ink] + [ 0 0 150 [] [0 0 1] /drop] + [ -250 0 150 [] [1 0 0] /drop] } ](4,4) \rput(0,0){\white 1} @@ -248,12 +323,12 @@ If a third drop is placed, the two previous drops will then be influenced by the \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, +\psMarble[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] + [ 0 0 150 [] [0 0 1] /drop] + [ -250 0 150 [] [1 0 0] /drop] + [ 250 0 150 [] [0 1 0] /drop] } ](4,4) \rput(0,0){\white 1} @@ -264,63 +339,73 @@ If a third drop is placed, the two previous drops will then be influenced by the \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}} - +\begin{center} +\url{http://people.csail.mit.edu/jaffer/Marbling/Mathematics} +\end{center} +\begin{center} +\url{https://www.computer.org/csdl/mags/cg/2012/06/mcg2012060026-abs.html} +\end{center} 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, + +\begin{minipage}[t]{6cm}\kern0pt +\begin{pspicture}(-3,-4)(3,4) +\psMarble[% 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] + 30 background [0.960 0.764 0.576] /drop] } 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] + 25 background [0.270 0.035 0.058] /drop] } 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] + 20 background [0.866 0.353 0.000 ] /drop] } repeat - [ 300 200 300 /vortex] - [ 0 -300 300 /vortex]}](6,12) + [ 300 200 -32e2 750 /vortex ] + [ 0 -300 32e2 750 /vortex ]}](6,8) \end{pspicture} -\end{center} -\begin{verbatim} -\begin{pspicture}(-3,-6)(3,6) -\psMarble[L=100, +\end{minipage} +\hfill +\begin{minipage}[t]{10cm}\kern0pt +{\small\begin{verbatim} +\begin{pspicture}(-3,-4)(3,4) +\psMarble[% 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] + 30 background [0.960 0.764 0.576] /drop] } 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] + 25 background [0.270 0.035 0.058] /drop] } 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] + 20 background [0.866 0.353 0.000 ] /drop] } repeat - [ 300 200 300 /vortex] - [ 0 -300 300 /vortex]}](6,12) + [ 300 200 -32e2 750 /vortex ] + [ 0 -300 32e2 750 /vortex ]}](6,8) \end{pspicture} -\end{verbatim} +\end{verbatim}} +\end{minipage} + + +\newpage + \subsection{Concentric rings} @@ -329,167 +414,226 @@ Aubrey Jaffer describes the idea of ``concentric rings'' in: \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. +``At the start of the real marbling process, paints 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-Paint}{\emph{Dropping Paint}}. For now, we just want an paint pattern which shows subsequent displacements. In my first renderings, 5 virtual paints 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.'' +The boundaries between virtual paint 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) +\begin{pspicture}(-4,-4)(4,4) +\psMarble(8,8) \end{pspicture} \end{center} -\begin{verbatim} -\begin{pspicture}(-2,-2)(2,2) -\psMarble[actions={concentric-bands}](3,3) +{\small\begin{verbatim} +\begin{pspicture}(-4,-4)(4,4) +\psMarble(8,8) \end{pspicture} -\end{verbatim} +\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 command \Lcs{psMarble} contains the options \nxLkeyword{actions=}, \nxLkeyword{background=}, \nxLkeyword{bckg=true/false}, \nxLkeyword{viscosity=}, \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}. + +\medskip + \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{actions} & 0 0 40 colors length concentric-bands & The type of marbling action\\ +\Lkeyword{background} & 0 0 0 & Background color\\ +\Lkeyword{bckg} & true & Boolean: to turn on/off the 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] + [0.960 0.764 0.576] + [0.316 0.362 0.298] + [0.200 0.050 0.015] + [0.023 0.145 0.451] + [0.866 0.353 0.050] + [0.200 0.050 0.015] }% - & 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)\\ + & Colors of the marbling to be set within the rgb-color-system\\ +\Lkeyword{drawcontours} & false & Boolean: if set to \texttt{true}, it only draws the contours\\ +\Lkeyword{viscosity} & 1000 & Global primitive: viscosity of the system---if taken negative pixeled image\\ \bottomrule \end{tabularx} \end{quote} +\medskip + \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}. +\item If \texttt{viscosity<0}, the image will be pixeled, if set to positive values it will be non-pixeled. +\item The boolean option \texttt{drawcontours} is by default set to \texttt{false}. If set to \texttt{true}, only the contours are drawn within the image. +\item Sometimes it is quite helpful to be able to turn off the background color. This can be handled with the boolean key \texttt{bckg}, which if set to \texttt{false} turns off the background color. +\item All colors need to be setup within the rgb-color-system. + + If one has a color from another color systen, for example: - 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. + \texttt{0.5 1 1 sethsbcolor} it is sufficient to just add \texttt{currentrgbcolor} at its end, like + + \texttt{0.5 1 1 sethsbcolor currentrgbcolor} to get the equivalent within the rgb-color-system. +\item Following are introduced some basic actions, like \texttt{/drop}, \texttt{random-drops}, \texttt{random-drops-colors}, \texttt{concentric-bands}, \texttt{/rake}, \texttt{/stroke}, \texttt{/stir}, \texttt{/vortex}, \texttt{/wiggle} and \texttt{/offset}. + + Within the basic actions \texttt{/stir} and \texttt{/vortex}, there is defined each with a radius \texttt{r} parameter. If \texttt{r>0} is set, the deformation is counterclockwise, if set to positive values, the deformation is clockwise. \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. +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. +\item To use forward-rendering (pixelfree) we choose the option \texttt{viscosity>0} with a positive value. +\item To use reverse-rendering (pixeled) we choose the option \texttt{viscosity<0} with a negative value. 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 \texttt{viscosity} (characteristic constant) a negative value. \end{itemize} -\begin{center} + +\begin{minipage}[t]{6cm}\kern0pt \begin{pspicture}(-3,-3)(3,3) -\psMarble[L=-100,viscosity=20,resolution=1,actions={concentric-bands}](6,6) +\psMarble[viscosity=-1000](6,6) \end{pspicture} -\hfill +{\small\begin{verbatim} \begin{pspicture}(-3,-3)(3,3) -\psMarble[L=-100,viscosity=20,resolution=0.5,actions={concentric-bands}](6,6) +\psMarble[viscosity=-1000](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{verbatim}} \end{minipage} \hfill -\begin{minipage}[t]{0.45\linewidth}\kern0pt -\begin{verbatim} +\begin{minipage}[t]{6cm}\kern0pt \begin{pspicture}(-3,-3)(3,3) -\psMarble[L=-100,viscosity=20, -resolution=0.5, -actions={concentric-bands}](6,6) +\psMarble[viscosity=1000](6,6) \end{pspicture} -\end{verbatim} +{\small\begin{verbatim} +\begin{pspicture}(-3,-3)(3,3) +\psMarble[viscosity=1000](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{minipage}[t]{6cm}\kern0pt \begin{pspicture}(-3,-3)(3,3) -\psMarble[actions={concentric-bands}](6,6) +\psMarble(6,6) \end{pspicture} -\end{center} -\begin{verbatim} +{\small\begin{verbatim} \begin{pspicture}(-3,-3)(3,3) -\psMarble[actions={concentric-bands}](6,6) +\psMarble(6,6) \end{pspicture} -\end{verbatim} -\begin{center} +\end{verbatim}} +\end{minipage} +\hfill +\begin{minipage}[t]{6cm}\kern0pt \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) +[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 ] +}](6,6) \end{pspicture} -\end{center} -\begin{verbatim} +{\small\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) +[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 ] +}](6,6) \end{pspicture} -\end{verbatim} +\end{verbatim}} +\end{minipage} + +\bigskip + +\textbf{Note:} As experience tells, not all colors will print as well as shown within the PDF file, so one has to print the image to see if the colors are OK for a paper. Here a list of colors that print well: + +\bigskip + +\definecolor{printcolorA}{rgb}{0.275 0.569 0.796} +\definecolor{printcolorB}{rgb}{0.965 0.882 0.302} +\definecolor{printcolorC}{rgb}{0.176 0.353 0.129} +\definecolor{printcolorD}{rgb}{0.635 0.008 0.094} +\definecolor{printcolorE}{rgb}{0.078 0.165 0.518} +\definecolor{printcolorF}{rgb}{0.824 0.592 0.031} +\definecolor{printcolorG}{rgb}{0.059 0.522 0.392} +\definecolor{printcolorH}{rgb}{0.816 0.333 0.475} +\definecolor{printcolorI}{rgb}{0.365 0.153 0.435} +\definecolor{printcolorJ}{rgb}{0.624 0.588 0.439} + +\newcommand{\myPrint}[2]{% +\begin{pspicture}(-1.6,-1)(1.6,1) +\psframe[linecolor=#1,fillstyle=solid,fillcolor=#1](-1.6,-1)(1.6,1) +\rput(0,0){\footnotesize[#2]} +\end{pspicture} +} + +\bigskip + +{\renewcommand{\arraystretch}{2.75} +\begin{tabular}{ccccc} +\myPrint{printcolorA}{0.275 0.569 0.796} & +\myPrint{printcolorB}{0.965 0.882 0.302} & +\myPrint{printcolorC}{0.176 0.353 0.129} & +\myPrint{printcolorD}{0.176 0.353 0.129} & +\myPrint{printcolorE}{0.078 0.165 0.518} \\ +\myPrint{printcolorF}{0.824 0.592 0.031} & +\myPrint{printcolorG}{0.059 0.522 0.392} & +\myPrint{printcolorH}{0.816 0.333 0.475} & +\myPrint{printcolorI}{0.365 0.153 0.435} & +\myPrint{printcolorJ}{0.624 0.588 0.439} +\end{tabular}} + \newpage -\section{Predefined objects before deformation} -\subsection{\texttt{/ink}} +\section{Basic actions} + +Some of the deformation \nxLkeyword{actions=} which are initially setup within the \texttt{pst-marble.pro} can be manually changed by its parameters: -\texttt{/ink} defines a drop set on the surface of a liquid. + +\subsection{\texttt{/drop}} + +\texttt{/drop} defines a single drop set on the surface of a liquid. \begin{verbatim} - xc yc R r g b -[ 0 0 100 [] [0 0 1] /ink] +[ cx cy r [ bgc ] [ rgb ] /drop ] + +cx, cy Center coordinates +r Radius of the paint drop +[bgc] Background color of paint drop +[rgb] Color of paint drop \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. +This initially is a circle with its center at \texttt{(cx,cy)} and a radius \texttt{r}. The paint color is defined by the rgb-color-system. The empty slot \texttt{[]} is the background drop 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}. +In order to interpolate the color in reverse-rendering, the adjacent color must be known. \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] +[ 0 0 50 [] [1 0 0] /drop] +[ -200 0 70 [] [0 1 0] /drop] +[ 200 0 100 [] [0 0 1] /drop] }](6,6) \end{pspicture} \end{center} @@ -497,262 +641,671 @@ actions={% \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] +[ 0 0 50 [] [1 0 0] /drop] +[ -200 0 70 [] [0 1 0] /drop] +[ 200 0 100 [] [0 0 1] /drop] }](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: +\textbf{Note:} The paint drop top most on the stack is left undeformed (intact), whereas all the others are influenced by each other, according to the system constant. 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] +[ 0 0 50 [] color1 /drop] +[ -200 0 70 [] color2 /drop] +[ 200 0 100 [] color3 /drop] \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. +\subsection{\texttt{random-drops}} + +With \texttt{random-drops}, we randomly place drops onto a liquid surface within an area of (1 m $\times$ 1 m) with also randomly varying radii. + +The varying radii of the drops are calculated with: $r=(\text{size (in mm)})\cdot \text{e}^{x}$, with: $\text{e}=2.71828182$ and $0<x<1$. + +So the radii will vary between $r_\text{min}=\text{size}$ and $r_\text{max}=2.71828182\cdot \text{size}$ + +\begin{verbatim} +[ size [ color ] count random-drops ] + +count Number of the drops +size Size of the drops +color Color of the drops +\end{verbatim} + +\textbf{Note:} If we choose a large number of drops, the compilation time increases. + +\medskip + +\textbf{Example 1:} + \begin{center} \begin{pspicture}(-5,-5)(5,5) -\psMarble[actions={concentric-bands}](10,10) +\psMarble[viscosity=1000, + actions={ +% size color count + 50 [1 0 0 ] 10 random-drops + }](10,10) \end{pspicture} \end{center} -\begin{verbatim} +{\small\begin{verbatim} \begin{pspicture}(-5,-5)(5,5) -\psMarble[actions={concentric-bands}](10,10) +\psMarble[viscosity=1000, + actions={ +% size color count + 50 [1 0 0 ] 10 random-drops + }](10,10) \end{pspicture} -\end{verbatim} +\end{verbatim}} \newpage -\section{Basic deformation actions} +\textbf{Example 2:} -Some of the deformation \nxLkeyword{actions=} which are initially setup within the \texttt{pst-marble.pro} can be manually changed by its parameters: +\begin{center} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[viscosity=1000, + actions={ +% size color count + 50 [1 0 0 ] 10 random-drops +% size color count + 20 [0 0 1 ] 50 random-drops +% size color count + 15 [0 1 0 ] 100 random-drops + }](10,10) +\end{pspicture} +\end{center} +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[viscosity=1000, + actions={ +% size color count + 50 [1 0 0 ] 10 random-drops +% size color count + 20 [0 0 1 ] 50 random-drops +% size color count + 15 [0 1 0 ] 100 random-drops + }](10,10) +\end{pspicture} +\end{verbatim}} -\subsection{\texttt{/line-deformation}} -The documentation is on the web page: +\newpage + + +\subsection{\texttt{random-drops-colors}} + +With \texttt{random-drops-colors}, we randomly place drops onto a liquid surface within an area of (1 m $\times$ 1 m) with also randomly varying radii and randomly chosen colors. + +The varying radii of the drops are calculated with: $r=(\text{size (in mm)})\cdot \text{e}^{x}$, with: $\text{e}=2.71828182$ and $0<x<1$. + +So the radii will vary between $r_\text{min}=\text{size}$ and $r_\text{max}=2.71828182\cdot \text{size}$ + +The varying colors are calculated with: + +\verb+[background colors random:uniform colors length mul floor cvi get /drop]+ + +\begin{verbatim} +[ size count random-drops-colors ] + +count Number of the drops +size Size of the drops +\end{verbatim} + +\textbf{Example:} -\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*} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[viscosity=1000, + actions={ +% size count + 40 10 random-drops-colors + 25 20 random-drops-colors + 15 50 random-drops-colors + }](10,10) +\end{pspicture} \end{center} +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[viscosity=1000, + actions={ +% size count + 40 10 random-drops-colors + 25 20 random-drops-colors + 15 50 random-drops-colors + }](10,10) +\end{pspicture} +\end{verbatim}} + + +\newpage + + +\subsection{\texttt{concentric-bands}} + +With \texttt{concentric-bands}, we set the number of different colored concentric bands (\texttt{number of bands}) (at center \texttt{cx,cy}) with a \texttt{radius increment}. + +The original PostScript code we find within \texttt{pst-marble.pro} as: \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*} +/concentric-bands{ +% cx cy: Center coordinates +% radius increment: Multiplication coefficient between the sets of bands +% number of bands: Number of drops within one set = number of elements +% within the [array of colors] list +% [array of colors]: this is the list of colors +% within the colors={...} key + /nbands exch def + /rinc exch def + /yc exch def + /xc exch def + 11 -1 1 + { + /rad exch sqrt rinc mul def + /cnt 0 def + nbands { + [ xc yc rad background colors cnt colors length mod get /drop] + /cnt cnt 1 add def + } repeat + } for + [ xc yc rinc 2 div background colors 0 get /drop] +} def \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. +\textbf{Explanation:} + +We have 11 sets of drops, within every set, the drops have the same radii and their radii will decrease with every step. The last set is given by the argument \texttt{rinc} and all the other radii are a function of this final radius. + +Within the first set of drops (with same radii), the number of drops is \texttt{nbands}---every drop of it has a color taken from the colors array and its radius values \texttt{sqrt(11)*rinc}. + +The sets go from 11 to 1 with a step of 1, meaning that the second set has a radius of \texttt{sqrt(10)*rinc} etc. + +The last set has a radius of \texttt{sqrt(1)*rinc=rinc}. + +A last single drop is then added with the radius of \texttt{r=rinc/2}. + + + +To code it within the \LaTeX{} file we use the following syntax: \begin{verbatim} - x y dx dy xs [ ys ] --> x' y' - x y dx dy [ xs ] ys --> x' y' +[ cx cy RadInc NbrBands concentric-bands ] + +cx, cy Center coordinates +RadInc Multiplication coefficient between the bands +NbrBands Number of the elements within + the [array of colors] list + [array of colors]: this is the list of colors + within the colors= key \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. + + +\newpage + + +\textbf{Example 1:} + +\texttt{concentric-bands} is the default action of the \texttt{actions=\{...\}} key, meaning if \textbf{no} action is chosen, \texttt{concentric-bands} with its default radius increment and its default color list is in effect. \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*} +\begin{pspicture}(-5,-5)(5,5) + \psMarble(10,10) +\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. +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) + \psMarble(10,10) +\end{pspicture} +\end{verbatim}} + + +\newpage + + +\textbf{Example 2:} + +If we want to change \texttt{RadInc} and \texttt{NbrBands}, we do the following: + +\medskip + \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)} +\psMarble[ + actions={ +% cx cy RadInc NbrBands + 0 0 25 6 concentric-bands + }](10,10) \end{pspicture} \end{center} -\begin{verbatim} +{\small\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)} +\psMarble[ + actions={ +% cx cy RadInc NbrBands + 0 0 25 6 concentric-bands + }](10,10) \end{pspicture} -\end{verbatim} +\end{verbatim}} + +\medskip + +\textbf{Note:} If one increases \texttt{RadInc} to large values $>100$ the area of the annuli increases by square, so not all annuli will be shown within the image, however they are calculated, which leads to longer compilation times and increases the final file size. + +Typical values are: $35<\text{\texttt{RadInc}}<50$ + +\newpage + + +\textbf{Example 3:} + +If we like to change the colors as well, we do this with the \texttt{colors=\{...\}} key, as follows: + \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)} +\psMarble[ + background=0.9 0.9 0.9, + colors={ + [0.08 0.3 0.51 ] + [0.18 0.76 1] + [0.93 1 1] + [0.08 0.3 0.51 ] + [0.8 0.75 0.82] + [1 0.99 0.65] + }, + actions={ +% cx cy RadInc NbrBands + 0 0 25 6 concentric-bands + }](10,10) \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)} +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[ + background=0.9 0.9 0.9, + colors={ + [0.08 0.3 0.51 ] + [0.18 0.76 1] + [0.93 1 1] + [0.08 0.3 0.51 ] + [0.8 0.75 0.82] + [1 0.99 0.65] + }, + actions={ +% cx cy RadInc NbrBands + 0 0 25 6 concentric-bands + }](10,10) \end{pspicture} +\end{verbatim}} + +\textbf{Note:} If the parameter \texttt{NbrBands} is i. e. set to 6, this means that there are six different colors within the bands in order (mod 6), so 6 colors should be setup within the \texttt{colors=\{...\}} key. If no colors are individually chosen by the \texttt{colors=\{...\}} key, the 6 predefined colors are used by default. + + +\newpage + + +\subsection{\texttt{/rake}} + +This is to represent the image obtained when the artist is equipped with a comb (rake) containing a number of identical teeth of a given diameter. He places the comb perpendicularly to the direction fixed by the angle made with the axis $Oy$ (the angle is counted: if taken positive values---clockwise, if taken negative values---counterclockwise) and moves it with a speed of \texttt{V} in the indicated direction or contrary to it, following the sign of the parameter \texttt{tU}. The positions of the teeth are set up by the distances (in mm) indicated [ between brackets ], the comb can also have only one tooth. + +By default, the tank's dimensions are 1 m $\times$ 1 m. The scaling factor of the image is 0.1. All lengths are in mm, velocities (in mm/s), angles (in degrees), angular velocity (in degrees/s), and viscosity and circulation (in mm$^2$/s). + +For a convex stylus or tine, \texttt{D} (in mm) is the ratio of its submerged volume to its wetted surface area. For a long cylinder it is its diameter. +\begin{verbatim} +[ angle [ r ] V tU D /rake ] + +angle Angle from y-axis in degrees; 0 is up. + - If angle positve: direction is north-east (>90 south-east). + - If angle negative: direction is north-west (<-90 south-west). +[ r ] List of distances to the teeth of the rake from its center. + - If r positive: distance to tooth, right to the indicated direction. + - If r positive: distance to tooth, left to the indicated direction. +V Stylus velocity in mm/s +tU Distance between the original points and the deformed points + along the stylus track. + - If tU positive: deformation in the indicated direction. + - If tU negative: deformation contrary to the indicated direction. +D Stylus diameter in mm. Make larger to affect paint farther away. \end{verbatim} +For the following examples \texttt{viscosity=1000} is set. This is a typical value (default value). + \newpage -\subsection{\texttt{/stroke-deformation}} -The documentation is on the web page: +\textbf{Explanations for the key \texttt{tU}:} -\centerline{ -\url{http://people.csail.mit.edu/jaffer/Marbling/Mathematics} -} +Setting: \verb![ 45 [ 200 ] 20 -100 50 /rake]! + +The orange circles are the ones without deformation. The black ones are the ones after deformation. +\begin{itemize} +\item Intersect orange outer circle with the yellow line $= P$ and $R$ +\item Intersect the black outer circle with the yellow line $= Q$ and $S$ +\end{itemize} +\begin{center} +\begin{pspicture*}(-5,-5)(5,5) +\psgrid[subgriddiv=1,gridcolor=lightgray!10] +\psMarble[viscosity=1000, +linewidth=0.1, +drawcontours, +bckg=false, +actions={9 -2 2 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0 0 0] /drop] + } for +% angle r V tU D +[ 45 [ 200 ] 20 -100 50 /rake] +}]% +\psMarble[viscosity=1000, +linewidth=0.1, +drawcontours, +bckg=false, +actions={9 -2 2 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [1 0.5 0] /drop] + } for +}]% +\psline[linecolor=red](-5,-5)(5,5) +\rput(!2 sqrt 2 sqrt neg){\psline[linecolor=yellow](-5,-5)(5,5)} +\psarcn[linewidth=0.1]{->}(0,0){3}{90}{45} +\uput{3.1}[67.5](0,0){$\alpha=45^{\mathrm{o}}$} +\psline{->}(0,0)(!2 sqrt 2 sqrt neg) +\uput[45](!2 sqrt 2 div 2 sqrt 2 div neg){$r>0$} + +\psdot[linecolor=blue,linewidth=0.2pt](2.43,-0.39) +\uput[0](2.43,-0.39){\textcolor{blue}{P}} +\psdot[linecolor=blue,linewidth=0.2pt](1.7,-1.165) +\uput[0](1.7,-1.165){\textcolor{blue}{Q}} +\psline[linecolor=blue,linewidth=1.5pt]{->}(2.43,-0.39)(1.7,-1.165) + +\psdot[linecolor=blue,linewidth=0.2pt](0.4,-2.42) +\uput[0](0.4,-2.42){\textcolor{blue}{R}} +\psdot[linecolor=blue,linewidth=0.2pt](-0.3,-3.1) +\uput[0](-0.3,-3.1){\textcolor{blue}{S}} +\psline[linecolor=blue,linewidth=1.5pt]{->}(0.4,-2.42)(-0.3,-3.1) +\end{pspicture*} +\end{center} +\begin{itemize} +\item The distance between $P$ and $Q$ is $|\overrightarrow{PQ}|$: + +$\text{\texttt{tU}}=|\overrightarrow{PQ}|=1\,\text{cm}$ with respect to the scaling factor 0.1 for the image, this gives \texttt{tU=100}, as it should. + +\item The distance between $R$ and $S$ is $|\overrightarrow{RS}|$: + +$\text{\texttt{tU}}=|\overrightarrow{RS}|=1\,\text{cm}$ with respect to the scaling factor 0.1 for the image, this gives \texttt{tU=100}, as it should. +\end{itemize} +\textbf{Note:} Within the given example \texttt{tU=-100} was chosen \textit{negative}. This indicates that the deformation is made contrary to the stylus track (set with \texttt{angle=45} (at a distance \texttt{[r=200]} from the red line) and drawn in yellow, so points to north-east, thus the deformation points move necessarily to south-west. + + +\newpage + + +\textbf{Example 1:} \verb+[ 45 [ 200 ] 20 -100 50 /rake]+ + +The angle is \texttt{angle=45}, means the direction of the stylus track north-east. (If the angle would be chosen to \texttt{angle=-45}, the stylus track would move north-west. + +The distance \texttt{[r=200]} (in mm) of one tooth from the center of the rake on the right side referred to the stylus track direction, if \texttt{r} is taken positive; to the left side to the stylus track direction, if \texttt{r} is taken negative.\\ +\textbf{Note:} The scaling factor of the image is 0.1. Thus 200 mm $\times$ 0.1 = 2 cm within the image. + +The stylus velocity is given with \texttt{V=20} (in mm/s). + +The distance \texttt{tU=-100} between the original points and the deformed points along the stylus track is set to negative (the deformation is made contrary to the to the direction of the stylus track). If taken a positive value for \texttt{tU}, the deformation is made in the direction of the stylus track. + +The stylus parameter \texttt{D} (given in mm) is the ratio of its submerged volume to its wetted surface area. The bigger this value, the wider the area of points that are affected by the deformation. +\begin{center} +\psscalebox{0.8}{% +\begin{pspicture*}(-5,-5)(5,5) +\psMarble[viscosity=1000, +linewidth=0.1, +drawcontours, +actions={30 -2 2 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0 0 0] /drop] + } for +% angle r V tU D +[ 45 [ 200 ] 20 -100 50 /rake] +}](10,10)% +\psline[linecolor=red](-5,-5)(5,5) +\rput(!2 sqrt 2 sqrt neg){\psline[linecolor=blue](-5,-5)(5,5)} +\psarcn[linewidth=0.1]{->}(0,0){2}{90}{45} +\uput{2.1}[67.5](0,0){$\alpha=45^{\mathrm{o}}$} +\psline{->}(0,0)(!2 sqrt 2 sqrt neg) +\uput[45](0.707,-0.707){$r>0$} +\rput(!2 sqrt 2 sqrt neg){\psline[linecolor=red,linewidth=0.1]{->}(0,0)(1;225)} +\rput(0.6,-1.7){\red tU} +\psgrid[subgriddiv=1,griddots=10,gridlabels=0pt] +\end{pspicture*}} +\end{center} +{\small\begin{verbatim} +\begin{pspicture*}(-5,-5)(5,5) +\psMarble[viscosity=1000,linewidth=0.1,drawcontours, +actions={30 -2 2 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0 0 0] /drop] + } for +% angle r V tU D +[ 45 [ 200 ] 20 -100 50 /rake] +}](10,10)% +\psline[linecolor=red](-5,-5)(5,5) +\rput(!2 sqrt 2 sqrt neg){\psline[linecolor=blue](-5,-5)(5,5)} +\psarcn[linewidth=0.1]{->}(0,0){2}{90}{45} +\uput{2.1}[67.5](0,0){$\alpha=45^{\mathrm{o}}$} +\psline{->}(0,0)(!2 sqrt 2 sqrt neg) +\uput[45](0.707,-0.707){$r>0$} +\rput(!2 sqrt 2 sqrt neg){\psline[linecolor=red,linewidth=0.1]{->}(0,0)(1;225)} +\rput(0.6,-1.7){\red tU} +\psgrid[subgriddiv=1,griddots=10,gridlabels=0pt] +\end{pspicture*} +\end{verbatim}} + + +\newpage + + +\textbf{Example 2:} \verb+[ 45 [ 200 ] 20 100 50 /rake]+ + +The angle is \texttt{angle=45}, means the direction of the stylus track is north-east. -Parameters for \texttt{/stroke-deformation}: \texttt{bx, by, ex, ey, wid} +The distance \texttt{[r=200]} of one tooth from the center of the rake on the right side referred to the stylus track direction, if \texttt{r} is taken positive; to the left side to the stylus track direction, if \texttt{r} is taken negative.\\ +\textbf{Note:} The scaling factor of the image is 0.1. Thus 200 mm $\times$ 0.1 = 2 cm within the image. -\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. +The stylus velocity is given with \texttt{V=20} (in mm/s). + +The distance \texttt{tU=100} between the original points and the deformed points along the stylus track is set to positive (the deformation is made to the direction of the stylus track). + +The stylus parameter \texttt{D} (given in mm) is set to 50 mm. +\begin{center} +\psscalebox{0.8}{% +\begin{pspicture*}(-5,-5)(5,5) +\psMarble[viscosity=1000,linewidth=0.1,drawcontours, +actions={30 -2 2 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0 0 0] /drop] + } for +% angle r V tU D +[ 45 [ 200 ] 20 100 50 /rake] +}](10,10)% +\psline[linecolor=red](-5,-5)(5,5) +\rput(!2 sqrt 2 sqrt neg){\psline[linecolor=blue](-5,-5)(5,5)} +\psarcn[linewidth=0.1]{->}(0,0){2}{90}{45} +\uput{2.1}[67.5](0,0){$\alpha=45^{\mathrm{o}}$} +\psline{->}(0,0)(!2 sqrt 2 sqrt neg) +\uput[45](0.707,-0.707){$r>0$} +\rput(!2 sqrt 2 sqrt neg){\psline[linecolor=red,linewidth=0.1]{->}(0,0)(1;45)} +\rput(2.5,-0.9){\red tU} +\psgrid[subgriddiv=1,griddots=10,gridlabels=0pt] +\end{pspicture*}} +\end{center} +{\small\begin{verbatim} +\begin{pspicture*}(-5,-5)(5,5) +\psMarble[viscosity=1000,linewidth=0.1,drawcontours, +actions={30 -2 2 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0 0 0] /drop] + } for +% angle r V tU D +[ 45 [ 200 ] 20 100 50 /rake] +}](10,10)% +\psline[linecolor=red](-5,-5)(5,5) +\rput(!2 sqrt 2 sqrt neg){\psline[linecolor=blue](-5,-5)(5,5)} +\psarcn[linewidth=0.1]{->}(0,0){2}{90}{45} +\uput{2.1}[67.5](0,0){$\alpha=45^{\mathrm{o}}$} +\psline{->}(0,0)(!2 sqrt 2 sqrt neg) +\uput[45](0.707,-0.707){$r>0$} +\rput(!2 sqrt 2 sqrt neg){\psline[linecolor=red,linewidth=0.1]{->}(0,0)(1;45)} +\rput(2.5,-0.9){\red tU} +\psgrid[subgriddiv=1,griddots=10,gridlabels=0pt] +\end{pspicture*} +\end{verbatim}} + + +\newpage + + +\textbf{Example 3:} \verb+[ 0 [-500 100 500 {} for] 50 100 30 /rake]+ + +The angle is \texttt{angle=0}, means the direction of the stylus track is north. + +The distance \texttt{[r]} is a list of 11 teeth: \texttt{[-500 100 500 {} for]} meaning the distances of the teeth are: \texttt{-500, -400, -300, -200, -100, 0, 100, 200, 300, 400, 500}. Starting at \texttt{-500} in steps of \texttt{100} up to \texttt{500}. (5 to the left of the indicated direction (the ones with negative values) and 5 to the right of the indicated direction (the ones with the positive values) and one tooth within the center. + +The stylus velocity is given with \texttt{V=50} (in mm/s). + +The distance \texttt{tU=100} between the original points and the deformed points along the stylus track is set to positive (the deformation is made to the direction of the stylus track). + +The stylus parameter \texttt{D} (given in mm) is set to 30 mm. + +\begin{minipage}[t]{8cm}\kern0pt +\begin{center} +\begin{pspicture}(-4,-5)(4,5) +\psset{viscosity=1000}% +\psMarble[ +actions={% +% cx cy radinc count + 0 0 35 6 concentric-bands +% angle r V tU D +% rake with 11 teeth aligned 1 cm (= 100 pts) +[ 0 [-500 100 500 {} for] 50 100 30 /rake] +}](8,10)% +\psMarble[ +linewidth=0.05, +colors={[1 1 1]}, +bckg=false, +drawcontours, +actions={% +% cx cy radinc count + 0 0 35 6 concentric-bands +% angle r V tU D +% rake with 11 teeth aligned 1 cm (= 100 pts) +[ 0 [-500 100 500 {} for] 50 100 30 /rake] +}](8,10)% +\end{pspicture} +\end{center} +\end{minipage} +\hfill +\begin{minipage}[t]{8cm}\kern0pt +{\small\begin{verbatim} +\begin{pspicture}(-4,-5)(4,5) +\psset{viscosity=1000}% +\psMarble[ +actions={% +% cx cy radinc count + 0 0 35 6 concentric-bands +% angle r V tU D +% rake with 11 teeth aligned 1 cm (= 100 pts) +[ 0 [-500 100 500 {} for] 50 100 30 /rake] +}](8,10)% +\psMarble[ +linewidth=0.05, +colors={[1 1 1]}, +bckg=false, +drawcontours, +actions={% +% cx cy radinc count + 0 0 35 6 concentric-bands +% angle r V tU D +% rake with 11 teeth aligned 1 cm (= 100 pts) +[ 0 [-500 100 500 {} for] 50 100 30 /rake] +}](8,10)% +\end{pspicture} +\end{verbatim}} +\end{minipage} + +\medskip + +\textbf{Note:} Within this example two \verb+\psMarble+ commands are used! The second command of \verb+\psMarble+ is used to highlight the contours of the deformations in white color. Therefore it is needed to suppress the background color for this second command---which can be done with \texttt{bckg=false}. + + +\newpage + + +\subsection{\texttt{/stroke}} + +The documentation is on the web page: +\begin{center} +\url{http://people.csail.mit.edu/jaffer/Marbling/Mathematics} +\end{center} +Parameters for \texttt{/stroke-deformation}: \texttt{bx, by, ex, ey, V, D} \begin{verbatim} -/stroke-deformation -% px py [ bx by ex ey wid ] --> px py +[ bx by ex ey V D /stroke ] + +bx, by Beginning of stroke +ex, ey End of stroke +V Stylus velocity in mm/s +D Stylus diameter in mm. Make larger to affect paint farther away. \end{verbatim} + +\textbf{Example 1:} + \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 ] +\psMarble[viscosity=250, +actions={% +0 0 35 6 concentric-bands +% X1 begin Y1 begin X2 end Y2 end V D +[ 30 sin 400 mul 30 cos 400 mul 30 sin 100 mul 30 cos 100 mul 50 10 /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 +/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) +\psdot(!X1 Y1)\psline{->}(!X1 Y1)(!X2 Y2) \end{pspicture} \end{center} -\begin{verbatim} -%Parameters: wid=50 +{\small\begin{verbatim} \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 ] +\psMarble[viscosity=250, +actions={% +0 0 35 6 concentric-bands +% X1 begin Y1 begin X2 end Y2 end V D +[ 30 sin 400 mul 30 cos 400 mul 30 sin 100 mul 30 cos 100 mul 50 10 /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 +/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) +\psdot(!X1 Y1)\psline{->}(!X1 Y1)(!X2 Y2) \end{pspicture} -\end{verbatim} +\end{verbatim}} + + +\newpage + + +\textbf{Example 2:} \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 ] +\psMarble[viscosity=250, +actions={% +% cx cy radinc count + 0 0 35 6 concentric-bands +% X1 begin Y1 begin X2 end Y2 end V D +[ 30 sin 400 mul 30 cos 400 mul 30 sin 100 mul 30 cos 100 mul 200 30 /stroke ] }](10,10) \psset{linecolor=red,linewidth=0.1} \pstVerb{/scaleFactor 10 1000 div def @@ -761,17 +1314,18 @@ actions={concentric-bands /X2 30 sin 100 mul scaleFactor mul def /Y2 30 cos 100 mul scaleFactor mul def }% -\psdots(!X1 Y1)(!X2 Y2) +\psdot(!X1 Y1)%(!X2 Y2) \psline{->}(!X1 Y1)(!X2 Y2) \end{pspicture} \end{center} -\begin{verbatim} -%Parameters: wid=200 +{\small\begin{verbatim} \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 ] +\psMarble[viscosity=250, +actions={% +% cx cy radinc count + 0 0 35 6 concentric-bands +% X1 begin Y1 begin X2 end Y2 end V D +[ 30 sin 400 mul 30 cos 400 mul 30 sin 100 mul 30 cos 100 mul 200 30 /stroke ] }](10,10) \psset{linecolor=red,linewidth=0.1} \pstVerb{/scaleFactor 10 1000 div def @@ -780,323 +1334,545 @@ actions={concentric-bands /X2 30 sin 100 mul scaleFactor mul def /Y2 30 cos 100 mul scaleFactor mul def }% -\psdots(!X1 Y1)(!X2 Y2) +\psdot(!X1 Y1)%(!X2 Y2) \psline{->}(!X1 Y1)(!X2 Y2) \end{pspicture} -\end{verbatim} +\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. +\subsection{\texttt{/stir}} + +Consider a single stylus (a cylinder of diameter \texttt{D}) that is placed on the $Oy$-axis at a distance $r$ from the chosen center. In a circular motion, the artist rotates the stylus by an angle $\theta$. The angular velocity will influence the shape of the deformation. The direction of rotation is fixed by the sign of $\theta$. If $\theta>0$ the artist rotates counterclockwise \footnote{The sign of $r$ can also indicate the direction of rotation. If $r<0$ the direction of the rotation fixed by $\theta$ inverts.}. \begin{verbatim} - [ xC yC [ r ] /circle ] +[ cx cy [ r ] w th D /stir ] + +cx, cy Center coordinates in mm. +[ r ] List of radii in mm. +w Angular velocity in degrees/s. +th=theta Angle displacement at tines in degrees. +D Tine diameter in mm. \end{verbatim} -Within the brackets one can setup multiple radii, see example on page \pageref{ripple}. + +\medskip + +\textbf{Explanations for the key \texttt{th}:} + +Setting: \verb![ 0 0 [ 350 ] 10 70 10 /stir ]! + +\textbf{All} points on the circle are rotated by \texttt{th=70}. There is \textbf{no} partial stir operation. \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} +\begin{pspicture*}(-5,-5)(5,5) +\psgrid[subgriddiv=1,gridcolor=lightgray!10] +\psdot[dotstyle=+](0,0) +\pscircle[linestyle=dashed]{3.5} +\psMarble[viscosity=20,bckg=false, + actions={ + [ 350 0 15 background [0.22 0.27 0.4] /drop] + [ 350 20 cos mul 350 20 sin mul 15 background [0.49 0.75 0.79] /drop] + [ 350 40 cos mul 350 40 sin mul 15 background [0.9 0.8 0.47] /drop] + [ 350 60 cos mul 350 60 sin mul 15 background [0.98 0.27 0.317]/drop] + }] +\psMarble[viscosity=20,bckg=false, + actions={ + [ 350 0 15 background [0.22 0.27 0.4] /drop] + [ 350 20 cos mul 350 20 sin mul 15 background [0.49 0.75 0.79] /drop] + [ 350 40 cos mul 350 40 sin mul 15 background [0.9 0.8 0.47] /drop] + [ 350 60 cos mul 350 60 sin mul 15 background [0.98 0.27 0.317]/drop] + [ 0 0 [ 350 ] 10 70 10 /stir ] + }] +\psarc[arrowinset=0]{->}(0,0){3.9}{0}{70} +\psline[linecolor=blue](0;0)(3.5;0) +\psline[linecolor=blue](0;0)(3.5;70) +\uput[30](3.9;35){$\theta=70^\mathrm{o}$} \end{pspicture*} \end{center} -\begin{verbatim} -\begin{pspicture*}(-4,-4)(4,4) + + +\newpage + + +\textbf{Example 1:} + +\begin{center} +\begin{pspicture}(-5,-5)(5,5) \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} + actions={ + 9 -1 3 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.22 0.27 0.4] /drop] + [ 0 0 rad background [0.49 0.75 0.79] /drop] + [ 0 0 rad background [0.9 0.8 0.47] /drop] + [ 0 0 rad background [0.98 0.27 0.317]/drop] + } for + [ 0 -100 [ 200 ] 10 60 30 /stir ] + }](10,10) +\psdot[dotstyle=+,linecolor=white,linewidth=2pt](0,-1) +\pscircle[linestyle=dashed,linecolor=white](0,-1){2} +\psarc[linewidth=0.05,linestyle=dashed]{->}(0,-1){2}{90}{150} +\psline[linecolor=white,linestyle=dashed](0,-1)(0,1) +\psline[linecolor=white,linestyle=dashed](0,-1)(-1.732,0) +\psgrid[subgriddiv=1,griddots=10,gridlabels=0pt] +\end{pspicture} +\end{center} +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[ + actions={ + 9 -1 3 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.22 0.27 0.4] /drop] + [ 0 0 rad background [0.49 0.75 0.79] /drop] + [ 0 0 rad background [0.9 0.8 0.47] /drop] + [ 0 0 rad background [0.98 0.27 0.317]/drop] + } for + [ 0 -100 [ 200 ] 10 60 30 /stir ] + }](10,10) +\psdot[dotstyle=+,linecolor=white,linewidth=2pt](0,-1) +\pscircle[linestyle=dashed,linecolor=white](0,-1){2} +\psarc[linewidth=0.05,linestyle=dashed]{->}(0,-1){2}{90}{150} +\psline[linecolor=white,linestyle=dashed](0,-1)(0,1) +\psline[linecolor=white,linestyle=dashed](0,-1)(-1.732,0) +\psgrid[subgriddiv=1,griddots=10,gridlabels=0pt] +\end{pspicture} +\end{verbatim}} + + +\newpage + + +\textbf{Example 2:} + +If the artist repeats the same gesture several times, a whirlwind effect is created: + \begin{center} -\begin{pspicture*}(-4,-4)(4,4) +\begin{pspicture}(-5,-5)(5,5) \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*} + actions={ + 9 -1 3 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.22 0.27 0.4] /drop] + [ 0 0 rad background [0.49 0.75 0.79] /drop] + [ 0 0 rad background [0.9 0.8 0.47] /drop] + [ 0 0 rad background [0.98 0.27 0.317]/drop] + } for + 5{[ 0 -100 [ 200 ] 10 60 30 /stir ]} repeat + }](10,10) +\psgrid[subgriddiv=1,griddots=10,gridlabels=0pt] +\end{pspicture} \end{center} +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[ + actions={ + 9 -1 3 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.22 0.27 0.4] /drop] + [ 0 0 rad background [0.49 0.75 0.79] /drop] + [ 0 0 rad background [0.9 0.8 0.47] /drop] + [ 0 0 rad background [0.98 0.27 0.317]/drop] + } for + 5{[ 0 -100 [ 200 ] 10 60 30 /stir ]} repeat + }](10,10) +\psgrid[subgriddiv=1,griddots=10,gridlabels=0pt] +\end{pspicture} +\end{verbatim}} + + +\newpage + + +\textbf{Example 3:} + +The artist turns from two different centers, changing the direction of rotation. + +\textbf{Note:} Doing multiple deformations, the order of them is of importance! See the following examples placed next to each other where only the order of deformations is changed. +\begin{center} +\begin{minipage}[t]{8cm} +\begin{pspicture}(-4,-5)(4,5) +\psMarble[ + actions={ + 9 -1 3 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.22 0.27 0.4] /drop] + [ 0 0 rad background [0.49 0.75 0.79] /drop] + [ 0 0 rad background [0.9 0.8 0.47] /drop] + [ 0 0 rad background [0.98 0.27 0.317]/drop] + } for + [ 0 200 [ 200 ] 10 60 30 /stir ] + [ 0 -200 [ 200 ] -10 60 30 /stir ] + }](8,10) +\end{pspicture} +{\small\begin{verbatim} +\begin{pspicture}(-4,-5)(4,5) +\psMarble[ +actions={ +9 -1 3 +{ +/rad exch sqrt 50 mul def +[ 0 0 rad background [0.22 0.27 0.4] /drop] +[ 0 0 rad background [0.49 0.75 0.79] /drop] +[ 0 0 rad background [0.9 0.8 0.47] /drop] +[ 0 0 rad background [0.98 0.27 0.317]/drop] +} for +[ 0 200 [ 200 ] 10 60 30 /stir ] +[ 0 -200 [ 200 ] -10 60 30 /stir ] +}](8,10) +\end{pspicture} +\end{verbatim}} +\end{minipage} +\hfill +\begin{minipage}[t]{8cm} +\begin{pspicture}(-4,-5)(4,5) +\psMarble[ + actions={ + 9 -1 3 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.22 0.27 0.4] /drop] + [ 0 0 rad background [0.49 0.75 0.79] /drop] + [ 0 0 rad background [0.9 0.8 0.47] /drop] + [ 0 0 rad background [0.98 0.27 0.317]/drop] + } for + [ 0 -200 [ 200 ] -10 60 30 /stir ] + [ 0 200 [ 200 ] 10 60 30 /stir ] + }](8,10) +\end{pspicture} +{\small\begin{verbatim} +\begin{pspicture}(-4,-5)(4,5) +\psMarble[ +actions={ +9 -1 3 +{ +/rad exch sqrt 50 mul def +[ 0 0 rad background [0.22 0.27 0.4] /drop] +[ 0 0 rad background [0.49 0.75 0.79] /drop] +[ 0 0 rad background [0.9 0.8 0.47] /drop] +[ 0 0 rad background [0.98 0.27 0.317]/drop] +} for +[ 0 -200 [ 200 ] -10 60 30 /stir ] +[ 0 200 [ 200 ] 10 60 30 /stir ] +}](8,10) +\end{pspicture} +\end{verbatim}} +\end{minipage} +\end{center} + + +\newpage + + +\subsection{\texttt{/vortex}} + +\begin{verbatim} +[ cx cy circ t /vortex ] + +cx, cy Center coordinates in mm. +circ Circulation (in mm^2/s) is a simple scale factor. + Typical value: 30e3 mm^2/s. +t Time after circulation impulse at center. As t gets very large, the + whole surface returns to its original pattern, possibly with + rigid rotation. Typical value 10 s. +\end{verbatim} + +\texttt{/vortex} is modeled by a Lamb-Oseen vortex. We refer to the article written by Aubrey Jaffer: +\begin{center} +\url{http://people.csail.mit.edu/jaffer/Marbling/vortex.pdf} +\end{center} +The documentation illustrates the used parameters: + +center coordinates in mm, circulation $\mathrm{mm}^2$/s and the time s. + +After a long enough time, the whole surface returns to its initial state. This can be proofed within an animation to be compiled by the following verbatim code: + \begin{verbatim} -\begin{pspicture*}(-4,-4)(4,4) +\documentclass{article} +\usepackage{pst-marble,animate} +\begin{document} +\begin{animateinline}[% + controls,palindrome, + begin={\begin{pspicture}(-5,-5)(5,5)}, + end={\end{pspicture}} + ]{5}% 5 image/s +\multiframe{20}{rA=-3+0.65}{% \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*} + actions={% + 0 0 40 6 concentric-bands + [ 0 0 20 background color1 /drop] + [ 90 [ -400 400 600 {} for ] 40 200 31 /rake] + [-90 [ -600 400 600 {} for ] 40 200 31 /rake] + [0 0 -25200 5 \rA\space exp /vortex] + }](10,10) + } +\end{animateinline} +\end{document} \end{verbatim} -\newpage +Animated gifs can be seen at: +\begin{center} +\url{http://people.csail.mit.edu/jaffer/Marbling/} +\end{center} -\subsection{\texttt{/vortex-deformation}} +\newpage -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. +\textbf{Example 1:} \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) +\psMarble[viscosity=1000, + background=1 1 1, + actions= { + 9 -1 1 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.08 0.3 0.51 ] /drop] + [ 0 0 rad background [0.18 0.76 1] /drop] + [ 0 0 rad background [0.93 1 1] /drop] + [ 0 0 rad background [0.08 0.3 0.51 ] /drop] + [ 0 0 rad background [0.8 0.75 0.82] /drop] + [ 0 0 rad background [1 0.99 0.65] /drop] + } for + [0 100 /offset] + [ 0 0 -32e3 10 /vortex ] + }](10,10) \end{pspicture} \end{center} -\begin{verbatim} +{\small\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) +\psMarble[viscosity=1000, + background=1 1 1, + actions= { + 9 -1 1 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.08 0.3 0.51 ] /drop] + [ 0 0 rad background [0.18 0.76 1] /drop] + [ 0 0 rad background [0.93 1 1] /drop] + [ 0 0 rad background [0.08 0.3 0.51 ] /drop] + [ 0 0 rad background [0.8 0.75 0.82] /drop] + [ 0 0 rad background [1 0.99 0.65] /drop] + } for + [0 100 /offset] + [ 0 0 -32e3 10 /vortex ] + }](10,10) \end{pspicture} -\end{verbatim} +\end{verbatim}} + + +\newpage + + +\textbf{Example 2:} \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] +\psMarble[viscosity=1000,drawcontours, +linewidth=0.1, +background=1 1 1, +actions= { +9 -1 1 +{ +/rad exch sqrt 50 mul def +[ 0 0 rad background [0 0 0 ] /drop] +[ 0 0 rad background [0 0 0 ] /drop] +[ 0 0 rad background [0 0 0 ] /drop] +[ 0 0 rad background [0 0 0 ] /drop] +[ 0 0 rad background [0 0 0 ] /drop] +[ 0 0 rad background [0 0 0 ] /drop] +} for +[0 100 /offset] +[ 0 0 -32e3 10 /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) +\psdot[dotstyle=+,dotsize=0.25,linecolor=red](0,0) \end{pspicture} \end{center} -\begin{verbatim} +{\small\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] +\psMarble[viscosity=1000,drawcontours, +linewidth=0.1, +background=1 1 1, +actions= { +9 -1 1 +{ +/rad exch sqrt 50 mul def +[ 0 0 rad background [0 0 0 ] /drop] +[ 0 0 rad background [0 0 0 ] /drop] +[ 0 0 rad background [0 0 0 ] /drop] +[ 0 0 rad background [0 0 0 ] /drop] +[ 0 0 rad background [0 0 0 ] /drop] +[ 0 0 rad background [0 0 0 ] /drop] +} for +[0 100 /offset] +[ 0 0 -32e3 10 /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) +\psdot[dotstyle=+,dotsize=0.25,linecolor=red](0,0) \end{pspicture} -\end{verbatim} +\end{verbatim}} -\newpage -\subsection{\texttt{/wiggle}} +\newpage -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. +\subsection{\texttt{/wiggle}} -Aubrey Jaffer coded this following command: +This instruction simulates the action of an artist who with the tip of the stylus draws undulations on the surface of the liquid. \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 +[ angle {func} /wiggle ] + +angle Wiggle will be perpendicular to angle from y-axis up. +{func} Function that "wiggles" the original image. \end{verbatim} -\texttt{(dx,dy)} represents a unitary vector which gives direction to the wanted deformation by $(u_x,u_y)$. +The direction is defined by the angle (we call it $\alpha=$ \texttt{angle}) with respect to the $y$-axis upwards; a positive value of $\alpha$ points clockwise. +\texttt{(dx, dy)} represents the unit vector in the desired deformation direction, $(u_x=\cos\alpha, u_y=\sin\alpha)$. \[ 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. + + +\newpage + + +\textbf{Example 1:} + +If one wishes to obtain a sinusoidal undulation parallel to the axis $Oy$, we set $\alpha=0$. In this case $(u_x=1, u_y=0)$, and a function i. e., a sinusoidal function with amplitude 50 and angular velocity $\omega=5$: $f(x,y)=50\sin(5y)$ that is coded: \texttt{\{5 mul sin 50 mul\}}, we will have: + +$x'=x+50\sin(5y); \ y'=y$. + +It is recalled that the coordinates are in mm. If on the interval $-500 <x <500 $ we want 5 \textit{periods}, we will take as angular velocity: $\omega=5\times 360/1000 = 1.8$ \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] - }] +\psMarble[drawcontours,linewidth=0.2, + actions={ + 10 -1 1 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.22 0.27 0.4] /drop] + [ 0 0 rad background [0.49 0.75 0.79] /drop] + [ 0 0 rad background [0.9 0.8 0.47] /drop] + [ 0 0 rad background [0.98 0.27 0.317]/drop] + } for + [ 0 {1.8 mul sin 50 mul} /wiggle] + }](10,10) \end{pspicture} \end{center} -\begin{verbatim} +{\small\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: +\psMarble[drawcontours,linewidth=0.2, + actions={ + 10 -1 1 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.22 0.27 0.4] /drop] + [ 0 0 rad background [0.49 0.75 0.79] /drop] + [ 0 0 rad background [0.9 0.8 0.47] /drop] + [ 0 0 rad background [0.98 0.27 0.317]/drop] + } for + [ 0 {1.8 mul sin 50 mul} /wiggle] + }](10,10) + \end{pspicture} +\end{verbatim}} + + +\newpage + + +\textbf{Example 2:} + +For a sinusoidal undulation parallel to the axis $Ox$, we set $\alpha=90$. In that case $(u_x=0,u_y=1)$, the function becomes $f(x,y)=50\sin(5x)$ and is coded like that: \texttt{\{5 mul sin 50 mul\}}, thus: + +$x'=x;\ y'=y+50\sin(5x)$. \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] - }] +\psMarble[drawcontours,linewidth=0.2, + actions={ + 10 -1 1 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.22 0.27 0.4] /drop] + [ 0 0 rad background [0.49 0.75 0.79] /drop] + [ 0 0 rad background [0.9 0.8 0.47] /drop] + [ 0 0 rad background [0.98 0.27 0.317]/drop] + } for + [ 90 {1.8 mul sin 50 mul} /wiggle] + }](10,10) \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] - }] +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[drawcontours,linewidth=0.2, + actions={ + 10 -1 1 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.22 0.27 0.4] /drop] + [ 0 0 rad background [0.49 0.75 0.79] /drop] + [ 0 0 rad background [0.9 0.8 0.47] /drop] + [ 0 0 rad background [0.98 0.27 0.317]/drop] + } for + [ 90 {1.8 mul sin 50 mul} /wiggle] + }](10,10) \end{pspicture} -\end{verbatim} -For inclined/oblique waves, we write: +\end{verbatim}} + + +\newpage + + +\textbf{Example 3:} + +For a sinusoidal undulation in direction of the line $y=x$, we set $\alpha=45^\mathrm{o}$ : \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] - }] +\psMarble[ + actions={ + 10 -1 1 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.22 0.27 0.4] /drop] + [ 0 0 rad background [0.49 0.75 0.79] /drop] + [ 0 0 rad background [0.9 0.8 0.47] /drop] + [ 0 0 rad background [0.98 0.27 0.317]/drop] + } for + [ 45 {2.5 mul sin 50 mul} /wiggle] +% [ -45 {2.5 mul sin 50 mul} /wiggle] + }](10,10) \end{pspicture} \end{center} -\begin{verbatim} +{\small\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] - }] +\psMarble[ + actions={ + 10 -1 1 + { + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.22 0.27 0.4] /drop] + [ 0 0 rad background [0.49 0.75 0.79] /drop] + [ 0 0 rad background [0.9 0.8 0.47] /drop] + [ 0 0 rad background [0.98 0.27 0.317]/drop] + } for + [ 45 {2.5 mul sin 50 mul} /wiggle] +% [ -45 {2.5 mul sin 50 mul} /wiggle] + }](10,10) \end{pspicture} -\end{verbatim} -\textbf{Note:} If the vector is not unitary, we write the following to normalize it: \texttt{1 1 normalize}. +\end{verbatim}} + + +\newpage -\textbf{Remark:} These transformations can be combined and also be reversed, example: + +\textbf{Example 4:} + +\textbf{Note:} These transformations can be combined and also be reversed, example: \begin{center} -\begin{pspicture}(-5,-7)(5,7) +\begin{pspicture}(-4,-4)(4,4) \psMarble[ colors={ [0.134 0.647 1.0 ] @@ -1105,14 +1881,15 @@ For inclined/oblique waves, we write: [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) + actions={% + 0 0 50 5 concentric-bands + [0 {3 mul sin 30 mul } /wiggle ] + [0 {3 mul sin -30 mul } /wiggle ] % reverse action + }](8,8) \end{pspicture} \end{center} -\begin{verbatim} -\begin{pspicture}(-5,-7)(5,7) +{\small\begin{verbatim} +\begin{pspicture}(-4,-4)(4,4) \psMarble[ colors={ [0.134 0.647 1.0 ] @@ -1121,32 +1898,34 @@ For inclined/oblique waves, we write: [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) + actions={% + 0 0 50 5 concentric-bands + [0 {3 mul sin 30 mul } /wiggle ] + [0 {3 mul sin -30 mul } /wiggle ] % reverse action + }](8,8) \end{pspicture} -\end{verbatim} +\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 +[ dx dy /offset ] + +dx Displacement of the image in x direction +dy Displacement of the image in y direction \end{verbatim} -The choice of units was made, so that 100 pts correspond to 1 cm within the image. +The choice of units was made, so that 100 pts correspond to 1 cm within the image. \texttt{dx}, \texttt{dy} is the translation vector with which the image is shifted. \begin{center} \begin{pspicture}(-5,-5)(5,5) -\psMarble[L=100,viscosity=50, - actions={concentric-bands -% dx dy - [100 100 /offset]}] +\psMarble[viscosity=50, + actions={% + 0 0 35 6 concentric-bands +% dx dy + [100 100 /offset]}] \pstVerb{/scaleFactor 10 1000 div def /xS1 100 scaleFactor mul def /yS1 100 scaleFactor mul def @@ -1158,12 +1937,13 @@ The choice of units was made, so that 100 pts correspond to 1 cm within the imag \end{pspicture} \end{center} The displacement vector is given by \texttt{dx} and \texttt{dy} in pts. -\begin{verbatim} +{\small\begin{verbatim} \begin{pspicture}(-5,-5)(5,5) -\psMarble[L=100,viscosity=50, - actions={concentric-bands -% dx dy - [100 100 /offset]}] +\psMarble[viscosity=50, + actions={% + 0 0 35 6 concentric-bands +% dx dy + [100 100 /offset]}] \pstVerb{/scaleFactor 10 1000 div def /xS1 100 scaleFactor mul def /yS1 100 scaleFactor mul def @@ -1173,509 +1953,549 @@ The displacement vector is given by \texttt{dx} and \texttt{dy} in pts. \psline[linestyle=dashed](0,-5)(0,5) \psline[linecolor=red]{->}(0,0)(1,1) \end{pspicture} -\end{verbatim} +\end{verbatim}} + \newpage -\section{Combined actions} -Some basic actions set together. One can create some quite artistic images. +\section{Combined actions -- Gallery} + +\textbf{Example 1:} + +\begin{center} +\begin{pspicture*}(-4,-1)(4,12) +\psMarble[viscosity=1000, background=0.9 0.9 0.9, + actions={% + 0 0 45 6 concentric-bands + [200 -100 /offset] + -100 20 140 + { /idx exch def + [-270 idx sub -30 idx 2 mul add [ -270 idx 3 mul sub ] 10 -90 50 /stir ] + } for + [90 {2 mul sin 10 mul} /wiggle ] + }](12,24) +\end{pspicture*} +\end{center} +{\small\begin{verbatim} +\begin{pspicture*}(-4,-1)(4,12) +\psMarble[viscosity=1000, background=0.9 0.9 0.9, + actions={% + 0 0 45 6 concentric-bands + [200 -100 /offset] + -100 20 140 + { /idx exch def + [-270 idx sub -30 idx 2 mul add [ -270 idx 3 mul sub ] 10 -90 50 /stir ] + } for + [90 {2 mul sin 10 mul} /wiggle ] + }](12,24) +\end{pspicture*} +\end{verbatim}} + + +\newpage -\textbf{Note:} The order of the actions is of importance! Also the direction of the deformation is important! -\subsection{Bouquets} +\textbf{Example 2:} \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 ] - }, +\begin{pspicture}(-5,-5)(5,5) +\psMarble[viscosity=1000, + background=0.9 0.9 0.9, 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) + -400 200 400 {/cy exch def + -400 200 400 {/cx exch def + [ cx cy 75 background [0.22 0.27 0.4] /drop] + } for + } for + -400 200 400 {/cy exch def + -400 200 400 {/cx exch def + [ cx cy 75 background [0.49 0.75 0.79] /drop] + } for + } for + -400 200 400 {/cy exch def + -400 200 400 {/cx exch def + [ cx cy 75 background [0.9 0.8 0.47] /drop] + } for + } for + -400 200 400 {/cy exch def + -400 200 400 {/cx exch def + [ cx cy 50 background [0.98 0.27 0.317] /drop] + } for + } for +[ 180 [-500 100 500 {} for] 50 100 30 /rake] + }](10,10) \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 ] - }, +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[viscosity=1000, + background=0.9 0.9 0.9, 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) + -400 200 400 {/cy exch def + -400 200 400 {/cx exch def + [ cx cy 75 background [0.22 0.27 0.4] /drop] + } for + } for + -400 200 400 {/cy exch def + -400 200 400 {/cx exch def + [ cx cy 75 background [0.49 0.75 0.79] /drop] + } for + } for + -400 200 400 {/cy exch def + -400 200 400 {/cx exch def + [ cx cy 75 background [0.9 0.8 0.47] /drop] + } for + } for + -400 200 400 {/cy exch def + -400 200 400 {/cx exch def + [ cx cy 50 background [0.98 0.27 0.317] /drop] + } for + } for +[ 180 [-500 100 500 {} for] 50 100 30 /rake] + }](10,10) \end{pspicture} -\end{verbatim} +\end{verbatim}} + \newpage -\subsection{Fern} + +\textbf{Example 3:} \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) +\begin{pspicture}(-5,-5)(5,5) +\psMarble[ + actions= { + 0 0 40 colors length concentric-bands + [ 0 [ 0 ] 40 200 31 /rake ] + [ 0 0 -32e3 750 /vortex ] + }](10,10) \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) +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[ + actions= { + 0 0 40 colors length concentric-bands + [ 0 [ 0 ] 40 200 31 /rake ] + [ 0 0 -32e3 750 /vortex ] + }](10,10) \end{pspicture} -\end{verbatim} +\end{verbatim}} + + +\newpage +\textbf{Example 4:} + \begin{center} \begin{pspicture}(-5,-5)(5,5) -\newpsstyle{YellowGlass}{linewidth=0.1,linecolor=gray,fillstyle=solid,fillcolor=gray} +\psMarble[viscosity=500, + actions= { + -500 100 500 + { + /idy exch def + -500 100 500 + { + /idx exch def + [ idx idy 55 [] [0.040 0.236 0.424] /drop ] + } for + } for + 250 { + [rand 1000 mod 500 sub % -800<x<800 + rand 1000 mod 500 sub % -400<y<400 + rand 15 mod 10 add % 10<r<20 + background [0.134 0.647 1 ] /drop] + } repeat + [ 45 [ -400 200 600 {} for ] 40 200 31 /rake] + [ 100 0 [ -350 ] 30 30 15 /stir ] + [-90 [ -500 200 600 {} for ] 40 200 31 /rake] + [ 0 0 [ -150 ] 60 30 15 /stir ] + }](10,10) +\end{pspicture} +\end{center} +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[viscosity=500, + actions= { + -500 100 500 + { + /idy exch def + -500 100 500 + { + /idx exch def + [ idx idy 55 [] [0.040 0.236 0.424] /drop ] + } for + } for + 250 { + [rand 1000 mod 500 sub % -800<x<800 + rand 1000 mod 500 sub % -400<y<400 + rand 15 mod 10 add % 10<r<20 + background [0.134 0.647 1 ] /drop] + } repeat + [ 45 [ -400 200 600 {} for ] 40 200 31 /rake] + [ 100 0 [ -350 ] 30 30 15 /stir ] + [-90 [ -500 200 600 {} for ] 40 200 31 /rake] + [ 0 0 [ -150 ] 60 30 15 /stir ] + }](10,10) +\end{pspicture} +\end{verbatim}} + + +\newpage + + +\textbf{Example 5:} + +\begin{center} +\newpsstyle{YellowGlass}{linecolor=gray,linewidth=0.1} \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, +\begin{pspicture}(-5,-5)(5,5) +\psset{viscosity=500,background=1 1 1, actions={ - 4 -1 1 + 3 { - /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] + /rad 100 def + [ 0 0 rad background [0.27 0.01 0.02] /drop] + [ 0 0 rad background [0.78 0.02 0.1] /drop] + [ 0 0 rad background [0.77 0.92 0.47] /drop] + [ 0 0 rad background [0.11 0.18 0.07] /drop] + [ 0 0 rad background [0.96 0.85 0.1] /drop] + } repeat + [ 0 0 100 background [0.78 0.02 0.1] /drop] + [ 0 0 50 background [0.77 0.92 0.47] /drop] + [ 0 0 20 background [00.11 0.18 0.0] /drop] + 0 72 359 + { + /a exch 2 mul def + [ a sin 400 mul a cos 400 mul a sin 100 mul a cos 100 mul 10 50 /stroke ] } 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){% +\PstLens[LensMagnification=2,LensRotation=50,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} +{\small\begin{verbatim} +\newpsstyle{YellowGlass}{linecolor=gray,linewidth=0.1} \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, +\begin{pspicture}(-5,-5)(5,5) +\psset{viscosity=500,background=1 1 1, actions={ - 4 -1 1 + 3 { - /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] + /rad 100 def + [ 0 0 rad background [0.27 0.01 0.02] /drop] + [ 0 0 rad background [0.78 0.02 0.1] /drop] + [ 0 0 rad background [0.77 0.92 0.47] /drop] + [ 0 0 rad background [0.11 0.18 0.07] /drop] + [ 0 0 rad background [0.96 0.85 0.1] /drop] + } repeat + [ 0 0 100 background [0.78 0.02 0.1] /drop] + [ 0 0 50 background [0.77 0.92 0.47] /drop] + [ 0 0 20 background [00.11 0.18 0.0] /drop] + 0 72 359 + { + /a exch 2 mul def + [ a sin 400 mul a cos 400 mul a sin 100 mul a cos 100 mul 10 50 /stroke] } 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){% +\PstLens[LensMagnification=2,LensRotation=50,LensSize=2,LensShadow=false,LensStyleGlass=YellowGlass](1,-1){% \psMarble(10,10)} \end{pspicture} -\end{verbatim} -\subsection{Draw contours only} +\end{verbatim}} + + +\newpage + + +\textbf{Example 6:} \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 +\begin{pspicture}(-5,-5)(5,5) +\psMarble[viscosity=1000, + background=0.64 0.70 0.79, + actions={% + 11 -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 ] + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.64 0.70 0.79] /drop] + [ 0 0 rad background [0.14 0.75 0.87] /drop] + [ 0 0 rad background [0.95 0.74 0 ] /drop] + [ 0 0 rad background [1 0.043 0.086 ] /drop] } 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) +-500 100 0 {/xpos exch def + [xpos -500 xpos 0 50 20 /stroke] + } for +0 100 500 {/xpos exch def + [xpos 500 xpos 0 50 20 /stroke] + } for +-500 100 0 {/ypos exch def + [500 ypos 0 ypos 50 20 /stroke] + } for +0 100 500 {/ypos exch def + [-500 ypos 0 ypos 50 20 /stroke] + } for + }](10,10) \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 +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[viscosity=1000, + background=0.64 0.70 0.79, + actions={% + 11 -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 ] + /rad exch sqrt 50 mul def + [ 0 0 rad background [0.64 0.70 0.79] /drop] + [ 0 0 rad background [0.14 0.75 0.87] /drop] + [ 0 0 rad background [0.95 0.74 0] /drop] + [ 0 0 rad background [1 0.043 0.086] /drop] } 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) +-500 100 0 {/xpos exch def + [xpos -500 xpos 0 50 20 /stroke] + } for +0 100 500 {/xpos exch def + [xpos 500 xpos 0 50 20 /stroke] + } for +-500 100 0 {/ypos exch def + [500 ypos 0 ypos 50 20 /stroke] + } for +0 100 500 {/ypos exch def + [-500 ypos 0 ypos 50 20 /stroke] + } for + }](10,10) \end{pspicture} -\end{verbatim} +\end{verbatim}} -\subsection{Ripple\label{ripple}} + +\newpage + + +\textbf{Example 7:} \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 +\begin{pspicture}(-5,-5)(5,5) +\psMarble[viscosity=1000, + background=0.87 0.73 0.58, + actions= { + -500 84 500 { - /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] + /idy exch def + -500 100 600 + { + /idx exch def + [ idx idy 45 background [0.298 0.370 0.247] /drop ] } for - [ 0 50 /offset] - [ 0 0 [ ripple ripple riplim {} for ] /circle ] - }](11,16) + } for + [ 90 [ -400 200 600 {} for ] 40 200 31 /rake] + [-90 [ -500 200 600 {} for ] 40 200 31 /rake] + [ 0 0 [ -350 ] 30 30 15 /stir ] + [ 0 0 [ -150 ] 60 30 15 /stir ] + }](10,10) \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 +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[viscosity=1000, + background=0.87 0.73 0.58, + actions= { + -500 84 500 + { + /idy exch def + -500 100 600 { - /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] + /idx exch def + [ idx idy 45 background [0.298 0.370 0.247] /drop ] } for - [ 0 50 /offset] - [ 0 0 [ ripple ripple riplim {} for ] /circle ] - }](11,16) + } for + [ 90 [ -400 200 600 {} for ] 40 200 31 /rake] + [-90 [ -500 200 600 {} for ] 40 200 31 /rake] + [ 0 0 [ -350 ] 30 30 15 /stir ] + [ 0 0 [ -150 ] 60 30 15 /stir ] + }](10,10) \end{pspicture} -\end{verbatim} +\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} +\newpage + -\subsection{Blendmode} +\textbf{Example 8:} \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) +\begin{pspicture}(-7.5,-8)(7.5,8) +\pstVerb{/ripple 75 def +/riplim ripple 6 mul def}% +\psMarble[ + actions={ + 0 0 40 colors length concentric-bands + [ 0 50 /offset] + [ 0 0 [ ripple ripple riplim {} for ] 10 180 30 /stir ] + }](15,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) +{\small\begin{verbatim} +\begin{pspicture}(-7.5,-8)(7.5,8) +\pstVerb{/ripple 75 def +/riplim ripple 6 mul def}% +\psMarble[ + actions={ + 0 0 40 colors length concentric-bands + [ 0 50 /offset] + [ 0 0 [ ripple ripple riplim {} for ] 10 180 30 /stir ] + }](15,16) \end{pspicture} -\end{verbatim} +\end{verbatim}} + + +\newpage + + +\textbf{Example 9: Blendmodes} + +In case one want to overlap various marblings one can use the following blendmodes: + +\texttt{/Lighten}, \texttt{/Darken}, \texttt{/Normal}, \texttt{/Multiply}, \texttt{/Screen}, \texttt{/Overlay}, \texttt{/ColorDodge}, \texttt{/ColorBurn}, \texttt{/HardLight}, \texttt{/SoftLight}, \texttt{/Difference}, \texttt{/Exclusion}, \texttt{/Saturation}, \texttt{/Color}, \texttt{/Luminosity}. + +The blendmode is setup right after \texttt{actions=\{} like: \texttt{/Darken .setblendmode} or some other of the blendmodes. + +\medskip \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, +\begin{pspicture}(-4,-4)(4,4) +\psMarble[viscosity=1000, 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) + 50 [1 0 0 ] 10 random-drops + 20 [0 0 1 ] 50 random-drops + 15 [0 1 0 ] 100 random-drops + }](8,8) +\psMarble[viscosity=1000,bckg=false, + actions={ + /Darken .setblendmode + -500 84 500 + { + /idy exch def + -500 100 600 + { + /idx exch def + [ idx idy 45 background [0.898 0.670 0.747] /drop ] + } for + } for + [ 90 [ -400 200 600 {} for ] 40 200 31 /rake] + [-90 [ -500 200 600 {} for ] 40 200 31 /rake] + [ 0 0 [ -350 ] 30 30 15 /stir ] + [ 0 0 [ -150 ] 60 30 15 /stir ] + }](8,8) \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, +{\small\begin{verbatim} +\begin{pspicture}(-5,-5)(5,5) +\psMarble[viscosity=1000, 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) + 50 [1 0 0 ] 10 random-drops + 20 [0 0 1 ] 50 random-drops + 15 [0 1 0 ] 100 random-drops + }](10,10) +\psMarble[viscosity=1000,bckg=false, + actions={ + /Darken .setblendmode + -500 84 500 + { + /idy exch def + -500 100 600 + { + /idx exch def + [ idx idy 45 background [0.898 0.670 0.747] /drop ] + } for + } for + [ 90 [ -400 200 600 {} for ] 40 200 31 /rake] + [-90 [ -500 200 600 {} for ] 40 200 31 /rake] + [ 0 0 [ -350 ] 30 30 15 /stir ] + [ 0 0 [ -150 ] 60 30 15 /stir ] + }](10,10) \end{pspicture} -\end{verbatim} +\end{verbatim}} + -\subsection{Transparency} +\newpage + + +\textbf{Example 10: Transparency} + +In case one want to overlap various marblings one can also use transparency: + +The transparency is setup right after \texttt{actions=\{} like: \texttt{0.45 .setopacityalpha} or some other value between 0 and 1. + +\medskip \begin{center} -\begin{pspicture}(-6,-8)(6,8) -\psMarble[ - background=1 1 0, +\begin{pspicture}(-4,-4)(4,4) +\psMarble[viscosity=1000, 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) + 50 [1 0 0 ] 10 random-drops + 20 [0 0 1 ] 50 random-drops + 15 [0 1 0 ] 100 random-drops + }](8,8) +\psMarble[viscosity=1000,bckg=false, + actions={ + 0.45 .setopacityalpha + -500 84 500 + { + /idy exch def + -500 100 600 + { + /idx exch def + [ idx idy 45 background [0.898 0.670 0.747] /drop ] + } for + } for + [ 90 [ -400 200 600 {} for ] 40 200 31 /rake] + [-90 [ -500 200 600 {} for ] 40 200 31 /rake] + [ 0 0 [ -350 ] 30 30 15 /stir ] + [ 0 0 [ -150 ] 60 30 15 /stir ] + }](8,8) \end{pspicture} -\begin{verbatim} -\begin{pspicture}(-6,-8)(6,8) -\psMarble[ - background=1 1 0, +\end{center} +{\small\begin{verbatim} +\begin{pspicture}(-4,-4)(4,4) +\psMarble[viscosity=1000, 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) + 50 [1 0 0 ] 10 random-drops + 20 [0 0 1 ] 50 random-drops + 15 [0 1 0 ] 100 random-drops + }](8,8) +\psMarble[viscosity=1000,bckg=false, + actions={ + 0.45 .setopacityalpha + -500 84 500 + { + /idy exch def + -500 100 600 + { + /idx exch def + [ idx idy 45 background [0.898 0.670 0.747] /drop ] + } for + } for + [ 90 [ -400 200 600 {} for ] 40 200 31 /rake] + [-90 [ -500 200 600 {} for ] 40 200 31 /rake] + [ 0 0 [ -350 ] 30 30 15 /stir ] + [ 0 0 [ -150 ] 60 30 15 /stir ] + }](8,8) \end{pspicture} -\end{verbatim} -\end{center} +\end{verbatim}} + \newpage + \section{List of all optional arguments for \texttt{pst-marble}} \xkvview{family=pst-marble,columns={key,type,default}} @@ -1689,4 +2509,4 @@ gradmidpoint=0.5,gradangle=45,gradbegin=white,gradend=gray} \egroup \printindex -\end{document}
\ No newline at end of file +\end{document} diff --git a/Master/texmf-dist/dvips/pst-marble/pst-marble.pro b/Master/texmf-dist/dvips/pst-marble/pst-marble.pro index 60a36806480..478b39d677a 100644 --- a/Master/texmf-dist/dvips/pst-marble/pst-marble.pro +++ b/Master/texmf-dist/dvips/pst-marble/pst-marble.pro @@ -1,28 +1,29 @@ +%%Creator: Aubrey Jaffer +%%For: Voluntocracy %%Copyright: 2018 Aubrey Jaffer %%Creator: Aubrey Jaffer %%For: Voluntocracy -%%CreationDate: 2018-09-13 -/plotdict 70 dict def +%%CreationDate: 2018-10-19 +/plotdict 100 dict def plotdict begin -/pi 3.141592653589793 def -/e 2.718281828459045 def - + /URL (http://people.csail.mit.edu/jaffer/Marbling) def + /pi 3.141592653589793 def + /e 2.718281828459045 def + /e^-1 1 e div def + /m4o3 -4 3.0 div 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 +% negative viscosity for (raster) reverse-marbling +/marble % nu (viscosity) { - /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 + dup /nu exch 1e-6 mul abs def + /reverse-rendering? exch 0 lt def + % 0 setlinewidth reverse-rendering? { @@ -35,33 +36,34 @@ plotdict begin /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 + /acnt actions length def +% set background field of each /drop 0 1 acnt -1 add { /sdx exch def actions sdx get aload pop /ct exch def - ct /ink eq + ct /drop eq { - pop pop pop /cy exch def /cx exch def - cx cy sdx find-ink-background /bgc exch def + pop pop pop /cy exch .001 mul def /cx exch .001 mul def + cx cy sdx find-drop-background /bgc exch def actions sdx get 3 bgc put } { - ct /line eq + ct /vortex eq {pop pop pop pop} { - ct /stroke eq + ct /stroke eq ct /rake eq or {pop pop pop pop pop} { - ct /circle eq ct /vortex eq or - {pop pop pop} + ct /stir eq + {pop pop pop pop pop pop} { ct /wiggle eq - {pop pop pop} + {pop pop} { ct /offset eq {pop pop} - {(unrecognized token) = ct =} + {(unrecognized token) = ct =} ifelse } ifelse } ifelse } ifelse @@ -73,27 +75,55 @@ plotdict begin do-raster } { -% orgx orgy translate - scl 1000. div dup scale - do-inks + orgx orgy translate + scl 1.0 div dup scale + do-drops } 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 +/ct-dispatch +{ + ct /rake eq + {rake-deformation} + { + ct /stroke eq + {stroke-deformation} + { + ct /stir eq + {stir-deformation} + { + ct /vortex eq + {vortex-deformation} + { + ct /wiggle eq + {wiggle} + { + ct /offset eq + {offset} + {(unrecognized token) = ct =} ifelse + } ifelse + } ifelse + } ifelse + } ifelse + } ifelse +} bind def + +%% Given x, y coordinates and index of /drop on stack, returns the rgb +%% vector of the drop immediately surrounding that drop. +/find-drop-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. + ct /drop eq + % movement due to 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 + /rad^2 exch .001 mul dup mul def + /cy exch .001 mul def /cx exch .001 mul 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 @@ -105,149 +135,134 @@ plotdict begin 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 + {ct-dispatch} ifelse /cdx cdx -1 add def } loop } bind def /offset % px py dx dy --> px py { - /dy exch def /dx exch def + /dy exch .001 mul def /dx exch .001 mul 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 +/wiggle % px py ang {func} --> px py { - /func exch def - /dy exch def /dx exch def + /func exch def /ang exch def + /dy ang cos def /dx ang sin def /py exch def /px exch def - /a py dx mul px dy mul sub func exec reverse-rendering? {neg} if def + /a py dx mul px dy mul sub 1000 mul func exec 1e-3 mul 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 +/stroke-deformation % px py bx by ex ey V D --> px py { - /wid exch def + /D exch .001 mul def /V exch .001 mul abs def reverse-rendering? { 4 2 roll } if - /ey exch def /ex exch def - /by exch def /bx exch def + /ey exch .001 mul def /ex exch .001 mul def + /by exch .001 mul def /bx exch .001 mul 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 - {} + /L V D dup mul mul nu div def + 1e-6 tU 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 + /nx ex bx sub tU div def /ny ey by sub tU div def + /rpts tU L 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 + /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 + /dxB bx px sub def /dyB by py sub def + /dxE ex px sub def /dyE ey py sub 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 + /denr e r L div exp r mul L mul 2 mul def + /dens e s L div exp s mul L mul 2 mul def + /inx r L mul ty dup mul sub tU mul denr div + s L 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 + /bx ex def /by ey def + /ex ex stpx add def /ey ey stpy add def } for - } ifelse + } if px py } bind def -/line-deformation % px py dx dy xs ys --> px py +/rake-deformation % [ ang [ rs ] V tU D /rake ] { - /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 + /D exch .001 mul def /tU exch .001 mul def /V exch .001 mul abs def + /rs exch def /ang exch def + /py exch def /px exch def + /dy ang cos def /dx ang sin def + /L^-1 nu V D dup mul mul div def + /a 0 def + rs + { + /r exch .001 mul def + /bx dy r mul def /by dx r mul neg def + px bx sub dy mul py by sub dx mul sub abs L^-1 mul + e^-1 exch exp tU mul a add /a exch def + } forall + /a a reverse-rendering? {neg} if def + px dx a mul add py dy a mul add } bind def -/circle-deformation % px py cx cy rs --> px py +/stir-deformation % [ cx cy [ rs ] w th D /stir ] { + /D exch .001 mul def /th exch def /w exch abs def /rs exch def - /cy exch def /cx exch def + /cy exch .001 mul def /cx exch .001 mul 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 + 1e-6 p-c lt + {rs { + /r exch .001 mul def + /L^-1 nu w pi 180 div mul r abs mul D dup mul mul div def + /a p-c r abs sub abs L^-1 mul e^-1 exch exp th mul r 0 lt {neg} if a add def - } forall + } forall + /a a reverse-rendering? {neg} if def + } if 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 +% An irrotational vortex. circ is circulation; t is time in seconds +/vortex-deformation % px py cx cy circ t --> px py { - /rad exch def - /cy exch def /cx exch def + /t exch def /circ exch 1e-6 mul def + /cy exch .001 mul def /cx exch .001 mul 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 + /p-c^2 px cx sub dup mul py cy sub dup mul add def + /a p-c^2 1e-6 lt + {0} + { nu 4 mul .75 exp + p-c^2 2 pi mul mul t div .75 exp + add m4o3 exp + 180 pi div mul circ mul reverse-rendering? {neg} if } + ifelse 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 +% movement due to drop. +/spread % px py cx cy rad --> px py { - /rad exch def /cy exch def /cx exch def /py exch def /px exch def + /rad exch .001 mul def /cy exch .001 mul def /cx exch .001 mul 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 @@ -260,29 +275,9 @@ plotdict begin idx 1 add 1 acnt -1 add { actions exch get aload pop /ct exch def - ct /ink eq + ct /drop 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 + {ct-dispatch} ifelse } for } bind def @@ -301,7 +296,7 @@ plotdict begin { dup /oy exch def Minsky-circle 2 copy - exch Cx add exch Cy add % shift center of ink + exch Cx add exch Cy add % shift center of drop composite-map lineto dup 0 gt oy 0 lt and {exit} if } loop @@ -310,17 +305,17 @@ plotdict begin } bind def % Fills (distorted) circles. -/do-inks % acnt = index of last action + 1 +/do-drops % 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 + /drop 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 + /Ir exch .001 mul def /Cy exch .001 mul def /Cx exch .001 mul def + /eps 10 scl sqrt div Ir 1000. mul div acnt idx sub 1 add log div def do-action } if } for @@ -360,7 +355,7 @@ plotdict begin /sharpen % 0<=x<=1 { - .5 sub dup abs 0.00001 lt {} {dup abs .66 exp div .63 mul} ifelse + .5 sub dup abs 1e-8 lt {} {dup abs .66 exp div .63 mul} ifelse .5 add } bind def @@ -371,19 +366,20 @@ plotdict begin /cdx acnt -1 add def { actions cdx get aload pop /ct exch def - ct /ink eq - % movement due to ink-drop. + ct /drop eq + % movement due to 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 + /rad^2 exch .001 mul dup mul def + /cy exch .001 mul def /cx exch .001 mul 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 + a^2 1e-10 lt {0.} {1. rad^2 a^2 div sub} ifelse /disc exch def disc 0. le { - disc -1 le + disc -1e-3 le {rgb} { /a disc neg sqrt sharpen def @@ -397,27 +393,7 @@ plotdict begin 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 + {ct-dispatch} ifelse /cdx cdx -1 add def cdx 0 lt {pop pop background exit} if } loop @@ -425,14 +401,14 @@ plotdict begin /do-raster { - loy resolution hiy + loy 1 hiy { /iy exch def - /fy iy orgy sub scl div 1000. mul def - lox resolution hix + /fy iy orgy sub scl div 1.0 mul def + lox 1 hix { /ix exch def - /fx ix orgx sub scl div 1000. mul def + /fx ix orgx sub scl div 1.0 mul def fx fy actions2rgb % color modifications % fy dup mul fx dup mul add sqrt dup @@ -442,7 +418,7 @@ plotdict begin % ifelse % end color modifications aload pop setrgbcolor - ix iy resolution dup rectfill + ix iy 1 1 rectfill } for } for } bind def @@ -457,118 +433,71 @@ plotdict begin % 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 +/color1 [0.960 0.764 0.576] bind def % deep red background +/color2 [0.316 0.362 0.298] bind def % blue /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 - +% Global: viscosity -/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 +% [ cx cy radinc [ bgc ] [ rgb ] /drop ] +% [ cx cy [ r ] w th D /stir ] +% [ cx cy circ t /vortex ] +% [ bx by ex ey V D /stroke ] +% [ angle [ r ] V tU D /rake ] +% [ angle {func} /wiggle ] +% [ dx dy /offset ] -% 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 +/Q 1 def -%%%%% ### norme ### -%% syntaxe : u norme --> |u| -/norme { - dup mul - exch - dup mul - add sqrt +/concentric-bands { +% xc yc radius increment number of bands % [array of colors] +% [array of colors] c'est le tableau donné en paramètres colors= + /nbands exch def + /rinc exch def + /yc exch def + /xc exch def + 11 -1 1 + { + /rad exch sqrt rinc mul def + /cnt 0 def + nbands { + [ xc yc rad background colors cnt colors length mod get /drop] + /cnt cnt 1 add def + } repeat + } for + [ xc yc rinc 2 div background colors 0 get /drop] } 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 +/random-drops { +/count exch def +/color exch def +/size exch def +count +{ + [ + random:uniform 1100 mul 550 sub + random:uniform 1100 mul 550 sub + e random:uniform exp size mul + background color /drop + ] + } repeat } def -%%%%% ### normalize ### -%% syntaxe : u normalize -> u / ||u|| -/normalize { -2 dict begin - /u defpoint - /n u norme def - u 1 n div mulv -end +/random-drops-colors { +/count exch def +/size exch def +count +{ + [ + random:uniform 1100 mul 550 sub + random:uniform 1100 mul 550 sub + e random:uniform exp size mul + background colors random:uniform colors length mul floor cvi get /drop + ] + } repeat } 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 index a4d254cd9f9..9f188063ac0 100644 --- a/Master/texmf-dist/tex/generic/pst-marble/pst-marble.tex +++ b/Master/texmf-dist/tex/generic/pst-marble/pst-marble.tex @@ -5,8 +5,9 @@ %% IMPORTANT NOTICE: %% %% %% %% Package `pst-marble' %% +%% Copyright (C) 2018 Aubrey Jaffer %% %% %% -%% Aubrey Jaffers, with help of Manuel Luque, Jürgen Gilg %% +%% Aubrey Jaffers, with help of Manuel Luque, Jürgen Gilg %% %% Email address: agj@alum.mit.edu %% %% %% %% This program can redistributed and/or modified under %% @@ -24,8 +25,8 @@ \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} +\def\fileversion{1.0} +\def\filedate{2018/10/19} \message{`PST' v\fileversion, \filedate} % \pstheader{pst-marble.pro} @@ -34,24 +35,24 @@ \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}{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, +\define@boolkey[psset]{pst-marble}[Pst@]{bckg}[true]{} +\psset[pst-marble]{background=1 1 1, + viscosity=1000, + bckg=true, + actions=0 0 40 colors length 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]}, +[0.960 0.764 0.576] +[0.316 0.362 0.298] +[0.200 0.050 0.015] +[0.023 0.145 0.451] +[0.866 0.353 0.050] +[0.200 0.050 0.015] +}, drawcontours=false }% \def\psMarble{\def\pst@par{}\pst@object{psMarble}} @@ -61,13 +62,10 @@ \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 +\pst@number\pslinewidth\space 1000 div setlinewidth plotdict begin /loy pageheight -2 div def /hiy pageheight 2 div def @@ -76,16 +74,18 @@ plotdict begin /orgx hix lox add 2 div def /orgy hiy loy add 2 div def orgx orgy translate -/actions [\pst@marble@actions] def +/actions [ \pst@marble@actions ] def /acnt actions length def \ifPst@drawcontours /Contours {stroke} def \else /Contours {fill} def \fi +\ifPst@bckg gsave background aload pop setrgbcolor lox loy pagewidth pageheight rectfill grestore +\fi gsave lox loy pagewidth pageheight rectclip - \pst@marble@visc \pst@marble@L marble + \pst@marble@visc marble grestore end }% fin du code ps diff --git a/Master/texmf-dist/tex/latex/pst-marble/pst-marble.sty b/Master/texmf-dist/tex/latex/pst-marble/pst-marble.sty index af463fa277c..63a68a01981 100644 --- a/Master/texmf-dist/tex/latex/pst-marble/pst-marble.sty +++ b/Master/texmf-dist/tex/latex/pst-marble/pst-marble.sty @@ -5,6 +5,7 @@ %% IMPORTANT NOTICE: %% %% %% %% Package `pst-marble' %% +%% Copyright (C) 2018 Aubrey Jaffer %% %% %% %% Aubrey Jaffers, with help of Manuel Luque, Jürgen Gilg %% %% Email address: agj@alum.mit.edu %% @@ -21,13 +22,13 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \RequirePackage{pstricks} -\ProvidesPackage{pst-marble}[2018/09/23 package wrapper for PSTricks pst-marble.tex] +\ProvidesPackage{pst-marble}[2018/10/19 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 ] + [2018/10/19 v. 1.0, PostScript prologue file ] \@addtofilelist{pst-marble.pro}}{}% \endinput |