有人能帮我用 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}