![参数化绘图 3D、螺旋线和星形球体](https://linux22.com/image/297243/%E5%8F%82%E6%95%B0%E5%8C%96%E7%BB%98%E5%9B%BE%203D%E3%80%81%E8%9E%BA%E6%97%8B%E7%BA%BF%E5%92%8C%E6%98%9F%E5%BD%A2%E7%90%83%E4%BD%93.png)
有人能帮我用 LaTeX 创建两个图——一个螺旋线和一个星体球体吗?所附图片是 Mathematica 的截图,显示了所需的结果。
答案1
运行xelatex
(需要一些时间)或latex->dvips->ps2pdf
:
\documentclass{article}
\usepackage{pst-solides3d}
\begin{document}
\psset{unit=0.75}
\begin{pspicture}(-3,-4)(3,6)
\psset{viewpoint=20 70 10 rtp2xyz,Decran=20,lightsrc=viewpoint}
% Parametric Surfaces
\defFunction[algebraic]{helix}(u,v)
{(1.2+0.5*cos(v))*cos(u)}
{(1.2+0.5*cos(v))*sin(u)}
{0.5*sin(v)+u/Pi}
\psSolid[object=surfaceparametree,linewidth=0.5\pslinewidth,
base=-7 6.5 0 TwoPi,hue=0 1,function=helix,ngrid=30 0.4]%
\gridIIID[Zmin=-3,Zmax=3](-2,2)(-2,2)
\end{pspicture}
\psset{unit=3cm}
\begin{pspicture}(-2,-2)(2,2)
\psset{viewpoint=20 70 10 rtp2xyz,Decran=20,lightsrc=viewpoint}
% Parametric Surfaces
\defFunction[algebraic]{helix}(u,v)
{(cos(v)*cos(u))^3}
{(cos(v)*sin(u))^3}
{sin(v)^3}
\psSolid[object=surfaceparametree,linewidth=0.5\pslinewidth,
base=0 Pi 0 TwoPi,fillcolor=red,function=helix,ngrid=20 40]%
\gridIIID[Zmin=-1,Zmax=1,showAxes=false](-1,1)(-1,1)
\end{pspicture}
\end{document}
答案2
这是我的版本:
\documentclass[border=10pt]{standalone}
\usepackage[pdftex]{graphicx}
\usepackage{pgfplots}
\usepgfplotslibrary{colormaps}
\begin{document}
\begin{tikzpicture}[yscale=2, xscale=1]
\begin{axis}[axis line style={draw=none},
view={170}{-20},
grid=major,
xmin=0,xmax=2,
ymin=0,ymax=2,
zmin=0,zmax=4,
enlargelimits=upper,
xtick=\empty,
ytick=\empty,
ztick=\empty,
%colormap/bone,
trig format plots=rad,
clip=false
]
\addplot3 [ surf, domain=0:12.566, domain y=0:6.28,
samples=70, samples y=70,
variable=\u, variable y=\v,
point meta=u*v, opacity=0.4 ]
({(1.2+0.5*cos(v))*cos(u)},
{(1.2+0.5*cos(v))*sin(u)},
{0.5*sin(v)+u/(3.0)});
\end{axis}
\end{tikzpicture}
\end{document}