我想创建一个由等距线段组成的螺旋,如下图所示。我尝试用各种方法绘制它。使用颜色来区分每种方法。
我使用的方法是:
\translate(!CP \tx@UserCoor)
与\multido
和\lineto
这是我原来的想法。
\makeatletter
\begin{pspicture}[showgrid](-5,-5)(5,5)
\pscustom[linecolor=red]
{
\moveto(0,0)
\multido{\r=0.1+0.1}{89}{\translate(!CP \tx@UserCoor)\lineto(!1 \r\space sqrt 700 mul PtoC)}
}
\end{pspicture}
\makeatother
\translate(!CP \tx@UserCoor)
与\multido
和\psline
这是我原来的想法。
\makeatletter
\begin{pspicture}[showgrid](-5,-5)(5,5)
\pscustom[linecolor=green]
{
\moveto(0,0)
\multido{\r=0.1+0.1}{89}{\translate(!CP \tx@UserCoor)\psline(!1 \r\space sqrt 700 mul PtoC)}
}
\end{pspicture}
\makeatother
\rlineto
和\multido
这是我原来的想法。
\begin{pspicture}[showgrid](-5,-5)(5,5)
\pscustom[linecolor=blue]
{
\moveto(0,0)
\multido{\r=0.1+0.1}{89}{\rlineto(!1 \r\space sqrt 700 mul PtoC)}
}
\end{pspicture}
\psVector
和\multido
这是赫伯特的主意。
\begin{pspicture}[showgrid](-5,-5)(5,5)
\psset{showpoints,dotstyle=o,dotscale=2,linecolor=red}
\psStartPoint(0,0)
\multido{\r=0.1+0.1}{89}{\psVector[arrows=-](!1 \r\space sqrt 700 mul PtoC)}
\end{pspicture}
\psnline
与\multido
,连接\points
和\expandafter
这是杰克的主意。
\begin{pspicture}[showgrid](-5,-5)(5,5)
\def\points{(0,0)}%
\multido{\r=0.1+0.1}{89}{\xdef\points{\points(!1 \r\space sqrt 700 mul PtoC)}}
\psset{linecolor=green}
\expandafter\psrline\points
\end{pspicture}
\curvepnodes
使用临时变量
这是克里斯托弗的主意。
\begin{pspicture}[showgrid](-5,-5)(5,5)
\pstVerb{tx@NodeDict begin /myX -1 def /myY 0 def end }%
\curvepnodes[plotpoints=90]{0}{89}{%
myX myY
t 0.1 mul sqrt 700 mul 1 exch PtoC
3 -1 roll add 3 1 roll add exch
2 copy /myY ED /myX ED
}{P}
\psnline[linecolor=blue](0,\Pnodecount){P}
\end{pspicture}
\psparametricplot
使用临时变量
这是克里斯托弗的想法的应用\psparametricplot
。
\begin{pspicture}[showgrid](-5,-5)(5,5)
\pstVerb{/myX -1 def /myY 0 def}%
\psparametricplot[plotpoints=90,linecolor=red]{0}{89}{%
myX myY
t 0.1 mul sqrt 700 mul 1 exch PtoC
3 -1 roll add 3 1 roll add exch
2 copy /myY ED /myX ED
}
\end{pspicture}
\curvepnodes
带for
环
这是克里斯托弗的主意。
\begin{pspicture}[showgrid](-5,-5)(5,5)
\curvepnodes[plotpoints=90]{0}{89}{%
-1 0
0 1 t
{
0.1 mul sqrt 700 mul 1 exch PtoC
3 -1 roll add 3 1 roll add exch
} for
}{P}
\psnline[linecolor=green](0,\Pnodecount){P}
\end{pspicture}
\psparametricplot
带for
环
这是克里斯托弗的想法的应用\psparametricplot
。
\begin{pspicture}[showgrid](-5,-5)(5,5)
\psparametricplot[plotpoints=90,linecolor=blue]{0}{89}{%
-1 0
0 1 t
{
0.1 mul sqrt 700 mul 1 exch PtoC
3 -1 roll add 3 1 roll add exch
} for
}
\end{pspicture}
完整代码
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pstricks-add}
\psset{showpoints,dotstyle=o,dotscale=2}
\begin{document}
\makeatletter
\begin{pspicture}[showgrid](-5,-5)(5,5)
\pscustom[linecolor=red]
{
\moveto(0,0)
\multido{\r=0.1+0.1}{89}{\translate(!CP \tx@UserCoor)\lineto(!1 \r\space sqrt 700 mul PtoC)}
}
\end{pspicture}
\makeatother
\makeatletter
\begin{pspicture}[showgrid](-5,-5)(5,5)
\pscustom[linecolor=green]
{
\moveto(0,0)
\multido{\r=0.1+0.1}{89}{\translate(!CP \tx@UserCoor)\psline(!1 \r\space sqrt 700 mul PtoC)}
}
\end{pspicture}
\makeatother
\begin{pspicture}[showgrid](-5,-5)(5,5)
\pscustom[linecolor=blue]
{
\moveto(0,0)
\multido{\r=0.1+0.1}{89}{\rlineto(!1 \r\space sqrt 700 mul PtoC)}
}
\end{pspicture}
\begin{pspicture}[showgrid](-5,-5)(5,5)
\psset{showpoints,dotstyle=o,dotscale=2,linecolor=red}
\psStartPoint(0,0)
\multido{\r=0.1+0.1}{89}{\psVector[arrows=-](!1 \r\space sqrt 700 mul PtoC)}
\end{pspicture}
\begin{pspicture}[showgrid](-5,-5)(5,5)
\def\points{(0,0)}%
\multido{\r=0.1+0.1}{89}{\xdef\points{\points(!1 \r\space sqrt 700 mul PtoC)}}
\psset{linecolor=green}
\expandafter\psrline\points
\end{pspicture}
\begin{pspicture}[showgrid](-5,-5)(5,5)
\pstVerb{tx@NodeDict begin /myX -1 def /myY 0 def end }%
\curvepnodes[plotpoints=90]{0}{89}{%
myX myY
t 0.1 mul sqrt 700 mul 1 exch PtoC
3 -1 roll add 3 1 roll add exch
2 copy /myY ED /myX ED
}{P}
\psnline[linecolor=blue](0,\Pnodecount){P}
\end{pspicture}
\begin{pspicture}[showgrid](-5,-5)(5,5)
\pstVerb{/myX -1 def /myY 0 def}%
\psparametricplot[plotpoints=90,linecolor=red]{0}{89}{%
myX myY
t 0.1 mul sqrt 700 mul 1 exch PtoC
3 -1 roll add 3 1 roll add exch
2 copy /myY ED /myX ED
}
\end{pspicture}
\begin{pspicture}[showgrid](-5,-5)(5,5)
\curvepnodes[plotpoints=90]{0}{89}{%
-1 0
0 1 t
{
0.1 mul sqrt 700 mul 1 exch PtoC
3 -1 roll add 3 1 roll add exch
} for
}{P}
\psnline[linecolor=green](0,\Pnodecount){P}
\end{pspicture}
\begin{pspicture}[showgrid](-5,-5)(5,5)
\psparametricplot[plotpoints=90,linecolor=blue]{0}{89}{%
-1 0
0 1 t
{
0.1 mul sqrt 700 mul 1 exch PtoC
3 -1 roll add 3 1 roll add exch
} for
}
\end{pspicture}
\end{document}
问题
这里该如何使用
\psplot
?还有其他方法吗?
当使用
\lineto
、\psline
和 时\rlineto
,如何使其showpoints
起作用?