![TikZ 或 PSTricks 中的 Nautilus Shell](https://linux22.com/image/275601/TikZ%20%E6%88%96%20PSTricks%20%E4%B8%AD%E7%9A%84%20Nautilus%20Shell.png)
关于如何重建鹦鹉螺壳的横截面(如下图所示),您有什么想法吗?
答案1
--shell-output(抱歉,必须这么做)
螺旋的斐波那契近似值。完全猜出颜色。偷了杰克的ncbar
(又一次!)。
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.markings,calc}
\tikzset{nctopath/.style={
to path=(\tikztostart) ..controls ($(\tikztostart)!1cm*#1!-90:(\tikztotarget)$) and
($(\tikztotarget)!($(\tikztostart)!1cm*#1!-50:(\tikztotarget)$)!70:(\tikztostart)$)..
(\tikztotarget)
},
}
\begin{document}
\begin{tikzpicture}
\def\totx{1}
\coordinate (n-1-1) at (0,0) {};
\foreach \x[count=\xi from 2, evaluate=\x as \temptotx using int(\x+\totx)] in {1,...,9}{
\draw[decoration={
markings,mark=between positions 0 and 1 step 0.249 with {
\coordinate (n-\x-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) ;
}
},postaction=decorate
]
(n-\x-1) arc (\x*90+180:(\x+1)*90+180:{(\temptotx)*3mm})
coordinate (n-\xi-1)
\pgfextra{\xdef\totx{\temptotx}};
}
\foreach \x[count=\xi from 5] in {1,...,4}{
\foreach \y in {2,...,5}{
\draw[ultra thick,draw=green!50,] (n-\x-\y) to[nctopath=\x] (n-\xi-\y);
}
}
\end{tikzpicture}
\end{document}
不过需要一点化妆。也许可以很好地遮蔽这些部分,并在贝壳中间放置一个渐变,以形成太阳耀斑等。
答案2
使用 PSTricks 只是为了好玩。以下内容并非最终版本。
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\psset{polarplot,algebraic}
\def\foo{2^(x/10)}
\def\goo#1{2 #1 10 div exp}
\def\hoo#1{%
\pscurve
(!\goo{#1 .4 add} \goo{#1 .4 add 2 Pi mul add} add 2 div #1 .4 add RadtoDeg PtoC)
(!\goo{#1 .6 add 2 Pi mul add} #1 .6 add RadtoDeg PtoC)}
\def\atom#1{%
\pscustom[fillstyle=solid,fillcolor=orange,linejoin=1]
{
\psplot{#1}{#1 .6 add}{\foo}
\hoo{#1}
\psplot{#1 .6 add 2 Pi mul add}{#1 2 Pi mul add}{\foo}
\closepath
}}
\begin{document}
\begin{pspicture}(-5,-5)(5,5)
\foreach \i in {16,15.7,...,-55}{\atom\i}
\end{pspicture}
\end{document}
希望下一次编辑能让它更真实。但你应该知道大概的意思了。
它是如何制作的?
所使用的算法非常简单,如下面的动画所示。
答案3
运行xelatex
或latex->dvips->ps2pdf
\documentclass[preview,border=12pt]{standalone}
\usepackage{pst-solides3d}
\begin{document}
\begin{pspicture}(-5.5,-6)(2,3)
\psset{viewpoint=20 120 60 rtp2xyz,Decran=20,lightsrc=-10 15 10}
% Parametric Surfaces
\psSolid[object=grille,base=-4 4 -4 4,action=draw*,linecolor={[cmyk]{1,0,1,0.5}}](0,0,-3)
\defFunction{shell}(u,v)
{1.2 v exp u Sin dup mul v Cos mul mul}
{1.2 v exp u Sin dup mul v Sin mul mul}
{1.2 v exp u Sin u Cos mul mul}
\psSolid[object=surfaceparametree,
linecolor={[cmyk]{1,0,1,0.5}},
base=0 pi pi 4 div neg 5 pi mul 2 div,
fillcolor=yellow!50,incolor=green!50,
function=shell,linewidth=0.5\pslinewidth,ngrid=25]
\end{pspicture}
\end{document}