[pstricks] sequence of interval

Michael Sharpe msharpe at ucsd.edu
Mon Feb 7 17:54:37 CET 2011


On Feb 7, 2011, at 6:21 AM, Herbert Voss wrote:

> Am 07.02.2011 13:59, schrieb Andrzej J. Maciejewski:
>> Hi, assume that you have two curves given parametrically:  t->(bx(t),by(t))
>> and  t->(ex(t),ey(t)).
>> I want to draw lines:
>> psline(bx(t),by(t))(ex(t),ey(t))
>> changing t in a loop.
> 
> that is only possible with PostScript notation:
> 
> \documentclass{article}
> \usepackage{pst-plot,multido}
> \SpecialCoor
> \begin{document}
> 
> \begin{pspicture}(-1,-1)(5,5)
> \psaxes[ticksize=0 -4pt]{->}(5,5)
> \psparametricplot[algebraic,linewidth=1.5pt,linecolor=blue]{0}{5}{2*sqrt(t)|sin(t)+t}
> \psparametricplot[algebraic,linewidth=1.5pt,linecolor=red]{0}{5}{2*sqrt(t)|cos(t)+t}
> \multido{\rA=0.0+0.25}{20}{%
>  \psline{<->}(!2 \rA\space sqrt mul
>                  \rA\space RadtoDeg sin \rA\space add)
>              (!2 \rA\space sqrt mul
>                  \rA\space RadtoDeg cos \rA\space add)}
> \end{pspicture}
> 
> \end{document}
> 
> 
> Herbert

You may also use node sequences, which may be a little simpler to work with.

\documentclass{article}
\usepackage{pst-plot,pst-node,multido}
\SpecialCoor
\begin{document}

\begin{pspicture}(-1,-1)(5,5)
\psaxes[ticksize=0 -4pt]{->}(5,5)
\psparametricplot[algebraic,linewidth=1.5pt,linecolor=blue]{0}{5}{2*sqrt(t)|sin(t)+t}
\psparametricplot[algebraic,linewidth=1.5pt,linecolor=red]{0}{5}{2*sqrt(t)|cos(t)+t}
% define nodes P0..P19 on first curve, nodes Q0..Q19 on second
\curvepnodes[plotpoints=20]{0}{5}{2*sqrt(t)|sin(t)+t}{P}
\curvepnodes[plotpoints=20]{0}{5}{2*sqrt(t)|cos(t)+t}{Q}
\multido{\i=0+1}{20}{%
 \psline{<->}(P\i)(Q\i)}
\end{pspicture}

\end{document}

Michael




More information about the PSTricks mailing list