\RequirePackage{pdfmanagement}
\SetKeys[document/metadata]
{pdfversion=1.7,pdfstandard=a-3b}

%% $Id: pst-venn-doc.tex 848 2018-12-04 09:25:49Z herbert $
\documentclass[fontsize=11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false,headings=small,
    headinclude=false,footinclude=false,oneside,
    %showframe
    ]{pst-doc}
\listfiles
\usepackage{xkeyval,pst-shell}
\let\pstShellFV\fileversion
\usepackage{enumitem,xltabular,hvindex,hvlogos,minted-code,hvextern,xkvview}
\setkeys{hv}{moveToExampleDir,ExampleDir=exa-pdf,showFilename=false,%
	force=false,tcbox}

\setlist{nosep}

\renewcommand\bgImage{\includegraphics{pst-shell-doc-title}}%

\lstset{language=PSTricks,
    morekeywords={psShell},basicstyle=\footnotesize\ttfamily}

\addbibresource{\jobname.bib}
\renewcommand\ResultBox{\fcolorbox{blue}{blue!20!white!60}}
\title{\texttt{pst-shell}}
\subtitle{Plotting sea shells; v.\pstShellFV}
\author{Manual Luque \\ Herbert Voß }
\docauthor{}

\begin{document}

\settitle


\tableofcontents
\clearpage

\definecolor{beige}{rgb}{0.88 0.8 0.6}
%\title{Modèle mathématique pour représenter les coquillages avec PSTricks}
%\author{manuel.luque27@gmail.com}
%\date{19 décembre 2016}

\section{The Equations}
The geometric modeling of seashells was carried out by M. B. Cortie. 
In the document "DIGITAL SEASHELLS,"
he provides the parametric equations, which are functions of 
14 parameters, in order to allow
the modeling of a very large number of seashells.~\cite{cortie93}

%\url{https://www.researchgate.net/publication/223141547_Digital_seashells}

\begin{align*}
\left\{
\begin{aligned}
 x &= D[A\sin\beta\cos\theta+R\cos(s+\phi)\cos(\theta+\Omega)-R\sin\mu\sin(s+\phi)\sin(\theta+\Omega)]\mathrm{e}^{\theta\cot\alpha}\\[1em]
 y &= D[-A\sin\beta\sin\theta-R\cos(s+\phi)\sin(\theta+\Omega)-R\sin\mu\sin(s+\phi)\cos(\theta+\Omega)]\mathrm{e}^{\theta\cot\alpha}\\[1em]
 z &= [-A\cos\beta+R\sin(s+\phi)\cos\mu]\mathrm{e}^{\theta\cot\alpha}
\end{aligned}
\right.
\end{align*}

\begin{align*}
R &= R_e+k\\
R_e &= \dfrac{1}{\sqrt{\dfrac{\cos^2(s)}{a^2}+\dfrac{\sin^2(s)}{b^2}}}\\
k &= L\mathbf{exp}\left(-\left[\dfrac{2(s-P)}{W_1}\right]^2-\left[\dfrac{2f(\theta)}{W_2}\right]^2\right)\\
f(\theta) &= \frac{360}{N}\left(\frac{N\theta}{2\pi}-\mathrm{int}\left(\frac{N\theta}{2\pi}\right)\right)\quad \theta(\mathrm{rd})
\end{align*}

Jorge Picado provides a derivation of these equations; it is very comprehensive and beautifully illustrated:
http://www.mat.uc.pt/~picado/conchas/index.html
Jorge Picado introduces the parameter $D = \pm 1$, thereby allowing for the representation of both sinistral (left-handed) and dextral (right-handed) shells.
Jorge Picado offers Mathematica code—which I have not been able to test myself—though the images illustrating
his page, accompanied by parameters for a wide range of shells, are highly illustrative. On the
American Mathematical Society website, Tony Phillips and Stony Brook also discuss the modeling of various
shells, providing code for implementation in Maple:
 \url{http://www.ams.org/samplings/feature-column/fcarc-shell1}

\section{The \LPack{pst-shell} package}
The \LPack{pst-shell} package enables the rendering of shells using PSTricks; it is essentially an adaptation of the
equations established by M. B. Cortie.~\cite{cortie93} 
The parameters used are identical to those found in the documents by 
M. B. Cortie and
Jorge Picado, so one should refer to these two authors for their definitions. 
While PSTricks may not offer
the rendering speed of Mathematica or Maple, nor the surface smoothing 
quality achievable with those programs
or POV-Ray, it does allow for customized representations—thanks to the 
options in \LPack{pst-solides3d}—that I
suspect would be far more difficult to create in Maple or Mathematica; t
his point will be explored further
using the Nautilus as a case study 
in a separate file. 
Here is the list of these parameters; I am providing
the default values, which are those of *Natica stellata*, 
Orange Moon (see Jorge Picado):

\begin{itemize}[nosep]
  \item D = 1 : A=25
  \item alpha=83 : beta=42 : mu=10 : Omega=30 : en degrés
  \item a=12 : b=20
  \item L=1
  \item P=1
  \item W1=1 : W2=1
  \item N=0
\end{itemize}

\section{Syntax}

\begin{BDef}
\Lcs{psShell}\OptArgs\OptArg*{\Largr{$x_0,y_0,z_0$}}
\end{BDef}

$x_0,y_0,z_0$ is preset to $0,0,0$.

\section{Predefined styles}

\begin{codeblockA}[title=The settings of the predifined styles]
\newpsstyle[pst-shell]{Achatina}{D=1,A=109,alpha=86.6,beta=8.5,mu=0,Omega=0,phi=0,a=32,b=48,L=0,P=0,W1=1,W2=1,N=0}
\newpsstyle[pst-shell]{Ammonite}{alpha=83,beta=90,phi=1,mu=1,Omega=1,A=2.5,a=1,b=0.9,L=0.5,W1=100,W2=20,P=10,N=15}
\newpsstyle[pst-shell]{Argonauta}{alpha=80,beta=90,phi=0,mu=0,Omega=0,A=2,a=2,b=1.5,L=0.3,W1=150,W2=20,P=5,N=30}%
\newpsstyle[pst-shell]{Codakia}{alpha=37,beta=90,phi=0,mu=1,Omega=1,A=10500,a=10000,b=10500,L=0,W1=0,W2=0,P=0,N=0}
\newpsstyle[pst-shell]{Conus}{D=1,A=7,alpha=87,beta=7,mu=0,Omega=0,phi=78,a=4.3,b=1,L=0,P=0,W1=0,W2=0,N=0}
\newpsstyle[pst-shell]{Epiteonium}{D=1,A=9.5,alpha=85.9,beta=9,mu=0,Omega=0,phi=81,a=2.1,b=1.6,L=1.3,P=-60,W1=200,W2=20,N=8.3}
\newpsstyle[pst-shell]{Escalaria}{alpha=86,beta=10,phi=45,mu=5,Omega=1,A=90,a=20,b=20,L=14,W1=180,W2=0.4,P=40,N=180}
\newpsstyle[pst-shell]{Helcion}{alpha=18,beta=90,phi=0,mu=0,Omega=-40,A=450,a=400,b=310,L=0,W1=0,W2=0,P=0,N=0}
\newpsstyle[pst-shell]{Lyria}{D=1,A=50,alpha=83.9,beta=-19,mu=1,Omega=-2,phi=45,a=40,b=14,L=4,P=0,W1=6,W2=27,N=8}
\newpsstyle[pst-shell]{Natalina}{alpha=80,beta=40,phi=55,mu=10,Omega=30,A=25,a=12,b=16,L=0,W1=0,W2=0,P=0,N=0}
\newpsstyle[pst-shell]{Nautilus}{D=-1,A=2,alpha=80,beta=90,mu=0,Omega=0,phi=0,a=2,b=1.5,L=0,P=0,W1=0,W2=0,N=0}
\newpsstyle[pst-shell]{Oxystele}{D=1,A=47,alpha=84.9,beta=7,mu=0,Omega=0,phi=-36,a=40,b=19,L=0,P=0,W1=1,W2=1,N=0}
\newpsstyle[pst-shell]{Planorbis}{alpha=84,beta=85,phi=10,mu=45,Omega=5,A=45,a=20,b=30,L=0,W1=0,W2=0,P=0,N=0}
\newpsstyle[pst-shell]{Tonna}{D=1,A=70,alpha=82.4,beta=0,mu=10,Omega=0,phi=0,a=58,b=50,L=0,P=0,W1=1,W2=1,N=0}
\newpsstyle[pst-shell]{Turritella}{D=1,A=22.2,alpha=88.9,beta=4,mu=1,Omega=-2,phi=55,a=1.3,b=1.5,L=0,P=0,W1=0,W2=0,N=0}
\end{codeblockA}



\normalsize
\iffalse
Note: D is 1 in every case.
+---------+------+----+----+----+----+-----+-----+-----+----+------+----+----+----+----+---+
 Mollusc  ¦ Alp  ¦Beta¦Phi ¦ mu ¦ ,°¦smin ¦smax ¦ A   ¦ a  ¦ b    ¦ P  ¦ W1 ¦ W2 ¦ N  ¦ L 
+---------+------+----+----+----+----+-----+-----+-----+----+------+----+----+----+----+---+
Natalina  ¦ 80   ¦ 40 ¦ 55 ¦ 10 ¦ 30 ¦-270 ¦ 62  ¦ 25  ¦ 12 ¦ 16   ¦ 0  ¦ 0  ¦ 0  ¦ 0  ¦ 0 
Lyria     ¦ 83.9 ¦-19 ¦ 45 ¦ 1  ¦-2  ¦ -51 ¦  9  ¦ 50  ¦ 40 ¦ 14   ¦ 0  ¦ 6  ¦ 27 ¦ 8  ¦ 4 
Turritella¦ 88.9 ¦ 4  ¦ 55 ¦ 1  ¦-2  ¦-267 ¦ 39  ¦ 22.2¦ 1.3¦ 1.5  ¦ 0  ¦ 0  ¦ 0  ¦ 0  ¦ 0 
Oxystele  ¦ 84.9 ¦ 7  ¦-36 ¦ 1  ¦-2  ¦ -70 ¦ 70  ¦ 47  ¦ 40 ¦ 19   ¦ 0  ¦ 0  ¦ 0  ¦ 0  ¦ 0 
Planorbis ¦ 84   ¦ 85 ¦ 10 ¦ 45 ¦ 5  ¦-150 ¦ 130 ¦ 45  ¦ 20 ¦ 30   ¦ 0  ¦ 0  ¦ 0  ¦ 0  ¦ 0 
Ammonite  ¦ 83   ¦ 90 ¦ 1  ¦ 1  ¦ 1  ¦-170 ¦ 170 ¦ 2.5 ¦ 1.0¦ 0.9  ¦ 10 ¦ 100¦ 20 ¦ 15 ¦ 0.5 
Conus     ¦ 87   ¦ 7  ¦ 78 ¦ 0  ¦ 0  ¦-180 ¦  2  ¦ 7   ¦ 4.3¦ 1.0  ¦ 0  ¦ 0  ¦ 0  ¦ 0  ¦ 0 
Helcion   ¦ 18   ¦ 90 ¦ 0  ¦ 0  ¦-40 ¦-180 ¦ 180 ¦ 450 ¦ 400¦ 310  ¦ 0  ¦ 0  ¦ 0  ¦ 0  ¦ 0 
Nautilus  ¦ 80   ¦ 90 ¦ 0  ¦ 0  ¦ 0  ¦-163 ¦ 163 ¦ 2   ¦ 2  ¦ 1.5  ¦ 0  ¦ 0  ¦ 0  ¦ 0  ¦ 0 
Codakia   ¦ 37   ¦ 90 ¦ 0  ¦ 1  ¦ 1  ¦-180 ¦ 180 ¦10500¦10000¦10500¦ 0  ¦ 0  ¦ 0  ¦ 0  ¦ 0 
\fi



\clearpage
%
\section*{Natica stellata, Orange Moon with basic parameters.}

\begin{externalDocument}[
  compiler=lualatex, runs=1, crop,
  %xindex, xindexOptions={-l DE --config AU},
  %mpwidth=0.6\linewidth, 
  usefancyvrb=false,
  docType=latex,
  showCode=true,
]{shell}
\RequirePackage{pdfmanagement}
\SetKeys[document/metadata]{pdfversion=1.7,pdfstandard=a-3b}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\psset[pst-solides3d]{viewpoint=1000 -50 20 rtp2xyz,lightsrc=viewpoint, Screen=25}
\begin{pspicture}(-3,-5)(4,1)
\psShell[ngrid=180 60,fillcolor=orange,incolor=yellow!10,base=720 -720 -270 90,linewidth=0.01pt]
\end{pspicture}
\end{document}
\end{externalDocument}

\section*{Argonauta}

\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
  %mpwidth=0.6\linewidth, 
  usefancyvrb=false,
  tcbox=true,
  showCode,
  docType=latex,
]{shell}
\DocumentMetadata{}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}(-5,-3)(5,3)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=100 -50 30 rtp2xyz,Screen=120}%
\psShell[style=Argonauta,ngrid=1080 45,incolor=white,
         fillcolor=yellow!10,linewidth=0.01,base=0 -3600 -180 180]
\end{pspicture}
\end{document}
\end{externalDocument}

\clearpage

\section*{Epiteonium}
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop,
  %xindex, xindexOptions={-l DE --config AU},
  %mpwidth=0.6\linewidth, 
  tcbox,
  showCode=true,
  usefancyvrb=false,
  docType=latex,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-US}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}(-5,-12)(5,0)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=5000 -180 -10 rtp2xyz,Screen=800}
\psShell[style=Epiteonium,ngrid=360 60,incolor=white,linecolor=black!30,
         base=1800 -360 -270 20,hue=0.05 0.5 0.5 1,linewidth=0.001pt]
\end{pspicture}
\end{document}
\end{externalDocument}

\clearpage
\section*{Lyria}
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\psset{unit=1.2cm}
\begin{pspicture}(-3,-7)(3,0)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=10000 -20 10 rtp2xyz,Screen=100}
\psShell[style=Lyria,base=1800 -360 -51 9,ngrid=360 60,incolor=yellow!50,hue=0.05 0.5 0.5 1,linewidth=0.001pt]
\end{pspicture}
\end{document}
\end{externalDocument}

\clearpage
\section*{Turritella}
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop,
  %xindex, xindexOptions={-l DE --config AU},
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}(-3,-18)(3,-1)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=1000 -30 10 rtp2xyz,Screen=800}
\psShell[style=Turritella,base=0 -7200 -267 39,ngrid=720 30,incolor=white,
  fillcolor=yellow!20,linewidth=0.01pt]
\end{pspicture}
\end{document}
\end{externalDocument}

\clearpage
\section*{Tonna}
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop,
  %xindex, xindexOptions={-l DE --config AU},
  %mpwidth=0.6\linewidth, 
  %frame,
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}(-5,-9)(5,1)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=1000 -10 10 rtp2xyz,Screen=100}
\psShell[style=Tonna,base=0 -7200 -90 60,ngrid=720 30,incolor=yellow!50!black!50,
  hue=0.05 0.5 0.5 1,linewidth=0.005]
\end{pspicture}
\end{document}
\end{externalDocument}


\clearpage
\section*{Achatina}
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop,
  %xindex, xindexOptions={-l DE --config AU},
  %mpwidth=0.6\linewidth, 
  %frame,
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}(-5,-10)(5,1)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=1000 -30 10 rtp2xyz,Screen=90}
\psShell[style=Achatina,base=0 -7200 -110 65,ngrid=720 36,incolor=yellow!50!black!50,
  hue=0.05 0.5 0.5 1,linewidth=0.005]
\end{pspicture}
\end{document}
\end{externalDocument}



\clearpage
\section*{Oxystele}
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop,
  %xindex, xindexOptions={-l DE --config AU},
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}(-5,-7)(5,1)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=1000 -30 10 rtp2xyz,Screen=100}
\psShell[style=Oxystele,base=0 -7200 -70 70,ngrid=720 36,incolor=yellow!50!black!50,
  hue=0.05 0.5 0.5 1,linewidth=0.005]
\end{pspicture}
\end{document}
\end{externalDocument}


\clearpage
\section*{Conus}
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop,
  %xindex, xindexOptions={-l DE --config AU},
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\RequirePackage{pdfmanagement}
\SetKeys[document/metadata]
{pdfversion=1.7,pdfstandard=a-3b}
%\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}(-3,-13)(3,1)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=1000 -10 10 rtp2xyz,Screen=1400}
\psShell[style=Conus,base=0 -7200 -180 2,ngrid=720 72,incolor=yellow!50!black!50,
  hue=0.05 0.5 0.5 1,linewidth=0.005]
\end{pspicture}
\end{document}
\end{externalDocument}


\clearpage
\section*{Natalina}
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}(-3,-7)(6,0)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=1000 -60 10 rtp2xyz,Screen=250}
\psShell[style=Natalina,base=0 -7200 -270 62,ngrid=720 30,incolor=yellow!40,
  fillcolor=yellow!20!blue!10,linewidth=0.01pt]
\end{pspicture}
\end{document}
\end{externalDocument}


%\newpsstyle[pst-shell]{Natalina}{alpha=80,beta=40,phi=55,mu=10,Omega=30,A=25,a=12,b=16,
%  L=0,W1=150,W2=20,P=0,N=0}
%Natalina  ¦ 80   ¦ 40 ¦ 55 ¦ 10 ¦ 30 ¦-270 ¦ 62  ¦ 25  ¦ 12 ¦ 16   ¦ 0  ¦ 0  ¦ 0  ¦ 0  ¦ 0 

\clearpage
\section*{Planorbis}
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}[showgrid=false](-4,-3)(6,2)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=1000 -60 10 rtp2xyz,Screen=150}
\psShell[style=Planorbis,base=0 -7200 -150 130,ngrid=720 30,incolor=yellow!40,
  fillcolor=yellow!20!blue!10,linewidth=0.01pt]
\end{pspicture}
\end{document}
\end{externalDocument}
%\newpsstyle[pst-shell]{Planorbis}{alpha=84,beta=85,phi=10,mu=45,Omega=5,A=45,a=20,b=30,
%  L=0,W1=0,W2=0,P=0,N=0}
%Planorbis ¦ 84   ¦ 85 ¦ 10 ¦ 45 ¦ 5  ¦-150 ¦ 130 ¦ 45  ¦ 20 ¦ 30   ¦ 0  ¦ 0  ¦ 0  ¦ 0  ¦ 0 


\clearpage
\section*{Ammonite}
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}[showgrid=false](-4,-2)(6,3)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=100 -60 20 rtp2xyz,Screen=200}
\psShell[style=Ammonite,base=0 -7200 -170 170,ngrid=720 30,incolor=yellow!40,
  fillcolor=yellow!20!blue!10,linewidth=0.01pt]
\end{pspicture}
\end{document}
\end{externalDocument}
%\newpsstyle[pst-shell]{Ammonite}{alpha=83,beta=90,phi=1,mu=1,Omega=1,A=2.5,a=1,b=0.9,
%  L=0.5,W1=100,W2=20,P=10,N=15}
% Mollusc  ¦ ,°  ¦ ,°¦ ,°¦ µ, ¦ ,°¦smin ¦smax ¦ A   ¦ a  ¦ b    ¦ P  ¦ W1 ¦ W2 ¦ N  ¦ L 
%Ammonite  ¦ 83   ¦ 90 ¦ 1  ¦ 1  ¦ 1  ¦-170 ¦ 170 ¦ 2.5 ¦ 1.0¦ 0.9  ¦ 10 ¦ 100¦ 20 ¦ 15 ¦ 0.5 



\clearpage
\section*{Helcion}
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}[showgrid=false](-1,-4)(10,4)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=4000 -90 20 rtp2xyz,Screen=50}
\psShell[style=Helcion,base=0 -7200 -180 180,ngrid=720 30,incolor=yellow!40,
  fillcolor=yellow!20!blue!10,linewidth=0.01pt]
\end{pspicture}
\end{document}
\end{externalDocument}

% Mollusc  ¦ ,°  ¦ ,°¦ ,°¦ µ, ¦ ,°¦smin ¦smax ¦ A   ¦ a  ¦ b    ¦ P  ¦ W1 ¦ W2 ¦ N  ¦ L 
%Helcion   ¦ 18   ¦ 90 ¦ 0  ¦ 0  ¦-40 ¦-180 ¦ 180 ¦ 450 ¦ 400¦ 310  ¦ 0  ¦ 0  ¦ 0  ¦ 0  ¦ 0 



\clearpage
\section*{Codakia}
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}[showgrid=false](-3,-1)(8,3)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=1.e6 -30 -10 rtp2xyz,Screen=500}
\psShell[style=Codakia,base=0 -2000 -180 180,ngrid=720 30,incolor=yellow!40,RotX=90,%RotY=90,
  fillcolor=yellow!20!blue!10,linewidth=0.01pt]
\end{pspicture}
\end{document}
\end{externalDocument}

% Mollusc  ¦ ,°  ¦ ,°¦ ,°¦ µ, ¦ ,°¦smin ¦smax ¦ A   ¦ a  ¦ b    ¦ P  ¦ W1 ¦ W2 ¦ N  ¦ L 
%+---------+------+----+----+----+----+-----+-----+-----+----+------+----+----+----+----+---+
%Codakia   ¦ 37   ¦ 90 ¦ 0  ¦ 1  ¦ 1  ¦-180 ¦ 180 ¦10500¦10000¦10500¦ 0  ¦ 0  ¦ 0  ¦ 0  ¦ 0 


\clearpage
\section*{Escalaria}
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\begin{pspicture}[showgrid=false](-3,-7)(3,0)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=800 -90 20 rtp2xyz,Screen=100}
\psShell[style=Escalaria,base=0 -7200 -180 180,ngrid=720 30,incolor=yellow!40,
  fillcolor=yellow!20!blue!10,linewidth=0.01pt]
\end{pspicture}
\end{document}
\end{externalDocument}

\clearpage
\section{The colorful patterns adorning seashells}
Hans Meinhardt developed the activator-inhibitor reaction-diffusion equations 
that allow for the simulation
of the colorful patterns found on a wide variety of seashells.~\cite{meinhardt} 
His book, 
»The Algorithmic Beauty of Seashells«,
contains all the equations, photographs of the shells, and a CD with a simulation program.
Naturally, this is the most challenging part—not so much generating the patterns themselves, but
applying them to the specific shape of the corresponding shell. 
Randolf Schultz successfully combined
these two elements—shell geometry and patterns in his program.~\cite{schultz}
%http://www.shelly.de/
It is shareware; the program can be used without purchasing it, though this prevents you from saving
your creations.
The following example attempts to approximate the patterns of the *Nautilus*. Other ways of representing
the »Nautilus« are explored in the dedicated file.


\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\definecolor{beige}{rgb}{0.88 0.8 0.6}
\begin{pspicture}(-3,-3)(4,4)
\psset[pst-solides3d]{lightsrc=viewpoint,viewpoint=50 -30 60 rtp2xyz,Screen=100}
\psShell[style=Nautilus,base=0 -3600 180 -180,ngrid=360 36,unit=1,incolor=beige,
  fillcolor=yellow!5,linewidth=0, fcol=0 72 360 36 2 div mul cvi 36 sub 
    { dup 1 exch 36 add { (0.8 0.1 0 setrgbcolor)} for} for]
\end{pspicture}
\end{document}
\end{externalDocument}

\clearpage
\section{Shells created with a data file}

\begin{verbatim}
\psShell[filename=data/nautile-360-36,...]
\end{verbatim}

\xLkeyword{filename}
In order to carry out the desired transformations.

\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\definecolor{beige}{rgb}{0.88 0.8 0.6}
\psset{unit=1.5}
\begin{pspicture}(-3.5,-2)(3.5,3)
\psset{lightsrc=viewpoint,viewpoint=50 -50 40 rtp2xyz,Screen=100,solidmemory}
\psShell[filename=data/nautile-360-36,incolor=white,fcol= 0 72 360 71 mul { dup 2 exch 36 add 
             { dup (rouge) exch 37 add (blue)} for} for]
\end{pspicture}
\end{document}
\end{externalDocument}

\clearpage

For the second drawing, we will create openings in the shell by removing 
every other facet. The \LKeyword{rm=\Larga{numbers of faces to remove}} keyword
 in \LPack{pst-solides3d} ought to handle this, but having encountered some 
 issues with it, I remove the facets directly using a PostScript macro; 
 the file is then saved so it can be reused without recalculating.


\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\psset{unit=1.5}
\begin{pspicture}(-4,-2)(3,3)
\psset{lightsrc=viewpoint,viewpoint=50 -50 30 rtp2xyz,Screen=50,solidmemory}
\psShell[filename=data/testnautile-360-36,deactivatecolor]
\end{pspicture}
\end{document}
\end{externalDocument}

\clearpage

You delete the facets directly using the \Lkeyword{rm} command, which takes much longer!
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\psset{unit=1.5}
\begin{pspicture}(-3,-3)(4,4)
\psset{lightsrc=viewpoint,viewpoint=50 -30 60 rtp2xyz,Screen=50,solidmemory}
\psShell[filename=data/nautile-360-36,deactivatecolor,rm= 0 72 360 71 mul {/i exch def i 2 i 36 add 
         {/j exch def j j 37 add} for} for]
\end{pspicture}
\end{document}
\end{externalDocument}

\clearpage

Change the resolution to $180\times24$ and save the file.
\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\definecolor{beige}{rgb}{0.88 0.8 0.6}
\psset{unit=2cm}
\begin{pspicture}(-3,-2)(4,3)
\psset{lightsrc=viewpoint,viewpoint=50 -30 30 rtp2xyz,Screen=50}
\psShell[filename=data/nautile-180-24,deactivatecolor,linewidth=0.001,
         precode=/n1 180 def /n2 24 def /n1n2 n1 n2 2 mul 1 sub mul def /step n2 2 mul def,
            rm= 0 step n1n2 { dup 2 exch n2 add 
                { dup n2 add 1 add} for} for]
\end{pspicture}
\end{document}
\end{externalDocument}

\clearpage

Other variations for coloring the seashell.

\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\definecolor{beige}{rgb}{0.88 0.8 0.6}
\begin{pspicture}(-3,-4)(4,3)
\psset{lightsrc=viewpoint,viewpoint=50 -30 60 rtp2xyz,Screen=50}
\psShell[style=Nautilus,D=1,base=0 -3600 -180 180,ngrid=360 36,incolor=red!30,
         fillcolor=yellow!5,linewidth=0, 
         fcol=0 72 360 36 2 div mul cvi 36 sub { dup 1 exch 36 add 
	              { (0.8 0.1 0 setrgbcolor) } for } for]
\end{pspicture}
\begin{pspicture}(-3,-4)(4,3)
\psset{viewpoint=100 -30 50 rtp2xyz,Screen=100}
\psShell[style=Nautilus,D=1,base=0 -720 -180 180,ngrid=90 36,linewidth=0.01pt,action=draw]
\end{pspicture}
\end{document}
\end{externalDocument}


\clearpage

\begin{externalDocument}[
  compiler=lualatex, runs=1, crop=true,
  %xindex, xindexOptions={-l DE --config AU},
%  force,
  %mpwidth=0.6\linewidth, 
  showCode=true,
  usefancyvrb=false,
  docType=latex,
  tcbox=true,
]{shell}
\DocumentMetadata{pdfversion=2.0, pdfstandard=A-2b, lang=en-GB}
\documentclass{article}
\pagestyle{empty}
\usepackage{libertinus}
%StartVisiblePreamble
\usepackage[dvipsnames,svgnames]{pstricks}   
\usepackage{pst-shell}
%StopVisiblePreamble
\begin{document}
\definecolor{beige}{rgb}{0.88 0.8 0.6}
\begin{pspicture}(-3,-3)(4,4)
\psset{lightsrc=viewpoint,viewpoint=50 -30 60 rtp2xyz,Screen=50}
\psShell[style=Nautilus,base=0 -3600 180 -180,ngrid=360 36,incolor=beige,
   fillcolor=yellow!5,linewidth=0,fcol=0 72 360 36 2 div mul cvi 36 sub 
     { dup 1 exch 36 add { (0.8 0.1 0 setrgbcolor)} for} for]
\end{pspicture}
\begin{pspicture}(-3,-3)(4,4)
\psset{lightsrc=viewpoint,viewpoint=50 -30 60 rtp2xyz,Screen=50}
\psShell[style=Nautilus,base=0 -3600 180 -180,ngrid=360 36,incolor=beige,
  fillcolor=yellow!5,linewidth=0,fcol=0 2 360 36 2 div mul cvi 2 sub 
    { (0.8 0.1 0 setrgbcolor)} for]
\end{pspicture}
\end{document}
\end{externalDocument}


\section{Saving data to external files}

With the optional argument \Lkeyword{writedata} one can save the data in external files.
The shell itself is not plotted.

\begin{verbatim}
\psShell[writedata,filename=data/myShell,...]
\end{verbatim}

Subdirectories must exist, otherwise the package throws  an error on PostScript level.
The external files are created with either a Ghostscript run \verb|gs <file>.ps| or when
converting the file to pdf. The example:


\begin{codeblockA}[title=write data file]{}
\begin{pspicture}(-4,-4)(4,4)
\psset{lightsrc=viewpoint,viewpoint=10 -20 0 rtp2xyz,Screen=10}
\psset{style=Nautilus,A=0.5,alpha=45,beta=90,a=0.5,b=0.75}
\psShell[writedata,filename=data/cockle,base=0 -3600 -180 200,
   ngrid=360 36,unit=4cm,linewidth=0.001,RotX=-90,incolor=white,fillcolor=white,
   fcol=0 2 360 36 2 div mul cvi 2 sub { (0.8 0.1 0 setrgbcolor)} for
        360 36 mul cvi 2 360 36 mul 2 mul 2 sub { (0 0 0.8 setrgbcolor)} for]
\end{pspicture}
\end{codeblockA}

creates four files in the subdirectory \verb|data/|:

\medskip
\runExtCmd[redirect,verbose]{ls -l data/cockle*}{shell}



%\section{List of all optional arguments for \texttt{pst-shell}}
%\xkvview{family=pst-shell,columns={key,type,default}}

\bgroup
\RaggedRight
\nocite{*}
\printbibliography
\egroup

\printindex



\end{document}




