绘制 Dini 的表面

绘制 Dini 的表面

根据维基百科,Dini 的表面由以下参数方程描述:

x = a \cos u \sin v
y = a \sin u \sin v
z = a (\cos v + \ln\tan v/2) + bu

因此,我想绘制表面并获得类似于下面的结果(从这里) 用于书籍封面(这就是为什么我想自己做而不是使用链接中的封面):

在此处输入图片描述

我的意思是,形状相同,不一定是颜色相同。

我尝试了以下代码但距离结果还很远:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
 \begin{axis}[view={60}{30}]
  \addplot3[surf,shader=flat,
  samples=20,
  domain=0:14*pi,y domain=0:2,
  z buffer=sort]
  ({ 2 *cos(x) * sin(y)}, {2*sin(x) * sin(y)}, {2*(cos(y)+ln(tan(y/2))) + 0.15*x});
 \end{axis}
\end{tikzpicture}

\end{document}

知道如何重现表面吗?可以采用不同的方法,而不仅仅是pgfplots


编辑:在使用下面接受的解决方案后,我决定在这里进行编辑以显示我得到的结果。此外,我在颜色图 Pastel 中搜索了颜色。

在此处输入图片描述

代码:

\documentclass[border=2mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\begin{document}
\begin{tikzpicture}
  \begin{axis}[
    view={15}{10},
    hide axis,
    width=12cm,height=6cm,
    mesh/interior colormap=
      {pastel}{
      rgb255(0.00cm)=(194,120,239);
      rgb255(0.08cm)=(206,149,243);
      rgb255(0.17cm)=(220,165,196);
      rgb255(0.25cm)=(231,178,165);
      rgb255(0.33cm)=(238,194,152);
      rgb255(0.42cm)=(243,214,149);
      rgb255(0.50cm)=(245,232,151);
      rgb255(0.58cm)=(241,243,161);
      rgb255(0.67cm)=(227,240,185);
      rgb255(0.75cm)=(196,226,218);
      rgb255(0.83cm)=(151,204,243);
      rgb255(0.92cm)=(109,180,236);
      },
    colormap/cool,
    trig format plots=rad,
    point meta={z*z+y*y-0.3*z},
  ]
  \addplot3[
    surf,
    %shader=faceted,
    faceted color=black!80,
    %faceted color=mapped color!50,
    line width=0.1pt,
    samples=150, samples y=20,
    domain=1.5*pi:6.5*pi, y domain=0.02*pi:0.12*pi,
    z buffer=sort
  ]
  (
  {2*(cos(y)+ln(tan(y/2))) + 0.6*x},
  {2 *cos(x) * sin(y)},
  {-2*sin(x) * sin(y)} 
  );
  \end{axis}
\end{tikzpicture}
\end{document}

答案1

维基百科可能是正确的。最重要的是,您需要添加trig format plots=rad。然后,您可以重新排序轴方向,更改参数和绘图范围,为内部和外部添加不同的颜色图,添加point meta,等等。这允许您定性地重现其结果。

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
 \begin{axis}[view={10}{10},hide axis,
 width=12cm,height=6cm,
 colormap={bluegray}{color=(blue) color=(gray!20)},
 mesh/interior colormap={orangered}{color=(red) color=(orange)},
 trig format plots=rad,point meta={z*z+y*y-0.3*z}]
  \addplot3[surf,%shader=flat,
  samples=201,samples y=25,
  domain=1.5*pi:6.5*pi,y domain=0.02*pi:0.12*pi,
  z buffer=sort]
  ({2*(cos(y)+ln(tan(y/2))) + 0.6*x},{2 *cos(x) * sin(y)}, {-2*sin(x) * sin(y)} 
  );
 \end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

或者,如果你想看到更明显的喇叭形状,

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
 \begin{axis}[view={12}{10},hide axis,
 width=16cm,height=9cm,
 colormap={blueyellow}{color=(blue) color=(yellow)},
 mesh/interior colormap={orangeyellow}{color=(red) color=(yellow)},
 trig format plots=rad,point meta={z*z+y*y-0.5*z}]
  \addplot3[surf,%shader=flat,
  samples=101,samples y=15,
  domain=1.5*pi:6.5*pi,y domain=0.02*pi:0.48*pi,
  z buffer=sort]
  ({2*(cos(y)+ln(tan(y/2))) + 0.7*x},{2 *cos(x) * sin(y)}, {-2*sin(x) * sin(y)} 
  );
 \end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

或者用彩色图Sigur

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
 \begin{axis}[view={12}{10},hide axis,
 width=16cm,height=9cm,
 colormap={Sigur inv}{rgb255(0cm)=(106,172,233); rgb255(1cm)=(241,238,141); rgb255(2cm)=(181,99,233)},
 mesh/interior colormap={Sigur}{rgb255(0cm)=(181,99,233); rgb255(1cm)=(241,238,141); rgb255(2cm)=(106,172,233)},
 trig format plots=rad,point meta={z*z+y*y-0.5*z}]
  \addplot3[surf,%shader=flat,
  samples=101,samples y=15,faceted color=blue!40!mapped color,
  domain=1.5*pi:6.5*pi,y domain=0.02*pi:0.48*pi,
  z buffer=sort,line width=0.01pt]
  ({2*(cos(y)+ln(tan(y/2))) + 0.7*x},{2 *cos(x) * sin(y)}, {-2*sin(x) * sin(y)} 
  );
 \end{axis}
\end{tikzpicture}
\end{document}

在此处输入图片描述

所有这些都可以按照通常的方式制作动画。

\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\foreach \X in {0,0.1,...,1.9}
{\begin{tikzpicture}
 \begin{axis}[view={12}{10},hide axis,
 width=16cm,height=9cm,
 colormap={Sigur inv}{rgb255(0cm)=(106,172,233); rgb255(1cm)=(241,238,141); rgb255(2cm)=(181,99,233)},
 mesh/interior colormap={Sigur}{rgb255(0cm)=(181,99,233); rgb255(1cm)=(241,238,141); rgb255(2cm)=(106,172,233)},
 trig format plots=rad,point meta={z*z+y*y-0.5*z}]
  \addplot3[surf,%shader=flat,
  samples=101,samples y=15,faceted color=blue!40!mapped color,
  domain={(1+\X)*pi}:{(6+\X)*pi},y domain=0.02*pi:0.48*pi,
  z buffer=sort,line width=0.01pt]
  ({2*(cos(y)+ln(tan(y/2))) + 0.7*x},{2 *cos(x) * sin(y)}, {-2*sin(x) * sin(y)} 
  );
 \end{axis}
\end{tikzpicture}}
\end{document}

在此处输入图片描述

答案2

\listfiles
\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}
\begin{document}

\def\A{3.0}
\def\B{0.5}
\begin{pspicture}(-3.5,-3.5)(3.2,13)
\psset[pst-solides3d]{viewpoint=20 -20 30 rtp2xyz,Decran=15,lightsrc=viewpoint}
\defFunction[algebraic]{shell}(u,v)%
   {\A*cos(u)*sin(v)}%
   {\A*sin(u)*sin(v)}%
   {\A*(cos(v)+ln(tan(v/2))) + \B*u}
\psSolid[object=surfaceparametree, 
  linecolor={[cmyk]{1,0,1,0.5}}, 
  base=0 pi 8 mul  0.1 2, fillcolor=yellow!50,
  incolor=green!50, function=shell, linewidth=0.5\pslinewidth,ngrid=100 50]%
\end{pspicture}
\end{document}

在此处输入图片描述在此处输入图片描述在此处输入图片描述

\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}
\begin{document}

\def\A{3.0}
\def\B{0.5}
\multido{\iA=0+20}{18}{%
\begin{pspicture}(-3.5,-3.5)(3.2,13)
\psset[pst-solides3d]{viewpoint=20 \iA\space 30 rtp2xyz,Decran=15,lightsrc=viewpoint}
\defFunction[algebraic]{shell}(u,v)%
   {\A*cos(u)*sin(v)}%
   {\A*sin(u)*sin(v)}%
   {\A*(cos(v)+ln(tan(v/2))) + \B*u}
\psSolid[object=surfaceparametree, 
  linecolor={[cmyk]{1,0,1,0.5}}, 
  base=0 pi 8 mul  0.1 2, fillcolor=yellow!50,
  incolor=green!50, function=shell, linewidth=0.5\pslinewidth,ngrid=100 50]%
\end{pspicture}}
\end{document}

然后convert从 ImageMagick 使用:

convert -delay 50 -loop 0 -density 300 -scale 300 -alpha remove test.pdf test.gif

最后一个动画的光源位于10 10 10

相关内容