我开始使用 PSTricks 制作 3D 图形,但无法获得第一个好的结果。
我究竟做错了什么?
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-node}
\usepackage{pst-plot}
\usepackage[utf8]{inputenc}
\usepackage{eurosym}
% -------- Paquetes de pst-all \usepackage{pst-all} paquete pstricks para
\usepackage{pst-plot}
\usepackage{pst-node}
\usepackage{pst-tree}
\usepackage{pst-grad}
\usepackage{pst-coil}
\usepackage{pst-text}
\usepackage{pst-3d}
\usepackage{pst-eps}
\usepackage[tiling]{pst-fill}
\usepackage{pstricks-add}
\usepackage{multido}
% ---- Fin Paquetes de pst-all
\begin{document}
\psset{unit=1.5, Alpha=45, Beta=30}
\begin{pspicture}(-3,-1.5)(3,4)
\pstThreeDCoor[xMin=-4,xMax=4,yMin=-4,
yMax=4,zMax=3, arrows=<->]
\psplotThreeD[plotstyle=line,linecolor=blue,
yPlotpoints=40,xPlotpoints=30, linewidth=0.5pt,
hiddenLine=true](-2,2)(-2,2)
{
x 100 mul cos y 100 mul sin sub
}
\rput[tl](-2,3.5){$f(x,y)=\cos (100x) - \sin (100y) $ }
\end{pspicture}
\end{document}
答案1
您只需要以下内容:
% latex filname.tex
% dvips filname.dvi
% ps2pdf filname.ps
\documentclass{article}
\usepackage{pst-3dplot}
\begin{document}
\begin{pspicture}(-3.2,-2.73)(3.18,3.65)
\pstThreeDCoor[
xMin = -4,
xMax = 4,
yMin = -4,
yMax = 4,
zMax = 3,
arrows = <->
]
\psplotThreeD[
plotstyle = line,
linecolor = blue,
yPlotpoints = 40,
xPlotpoints = 30,
linewidth = 0.5pt,
hiddenLine = true
](-2,2)(-2,2)
{x 100 mul cos y 100 mul sin sub}
\rput(0,3.5){$f(x,y) = \cos(100x) - \sin(100y)$}
\end{pspicture}
\end{document}
答案2
你需要pst-3dplot
包。你不需要所有其他的 - 这里有一个完整的 MWE
% arara: latex
% arara: dvips
% arara: ps2pdf
% !arara: indent: {overwrite: on}
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-3dplot}
\begin{document}
\psset{unit=1.5, Alpha=45, Beta=30}
\begin{pspicture}(-3,-1.5)(3,4)
\pstThreeDCoor[xMin=-4,xMax=4,yMin=-4,
yMax=4,zMax=3, arrows=<->]
\psplotThreeD[plotstyle=line,linecolor=blue,
yPlotpoints=40,xPlotpoints=30, linewidth=0.5pt,
hiddenLine=true](-2,2)(-2,2)
{
x 100 mul cos y 100 mul sin sub
}
\rput[tl](-2,3.5){$f(x,y)=\cos (100x) - \sin (100y) $ }
\end{pspicture}
\end{document}
答案3
另一个使用包的解决方案pst-solides3d
\documentclass[pstricks]{standalone}
\usepackage{pst-solides3d}
\begin{document}
\psset{unit=0.5,viewpoint=50 40 20 rtp2xyz,Decran=25,lightsrc=viewpoint,
stepX=2,stepY=2,stepZ=2}
\begin{pspicture}(-9,-8)(8,6)
\psSurface[ngrid=.5 .5,linewidth=0.5\pslinewidth,axesboxed,
algebraic,hue=0 1](-10,-10)(10,10){ cos(100*x)-sin(100*y) }
\end{pspicture}
\end{document}