[pstricks] multido again

Herbert Voss Herbert.Voss at FU-Berlin.DE
Thu Dec 4 23:22:07 CET 2008


Zbigniew Nitecki schrieb:
> I am trying to draw a series of arcs joining the same endpoints, with
> successively larger radii of curvature.  The following code returns an
> error indicating that an exclamation point somewhere is being read as a
> missing number (treated as zero).  What am I doing wrong? (It seems not
> to matter whether or not I put an exclamation point before the lone \rt
> in the first angle specification for the arc).

as Michael already wrote, the radius is read in another way
as the angles. You can redefine the \psarc macro to disable
the check for a unit of the radius.

\documentclass[a4paper,10pt]{article}
\usepackage{pstricks,multido}
\SpecialCoor
\makeatletter
\def\psarc at iii(#1)#2#3#4{%
  \begin at OpenObj
    \pst at getangle{#3}\pst at tempa
    \pst at getangle{#4}\pst at tempb
    \def\pst at tempA{#2 }
    \ifx\pst at tempa\pst at tempb \else
      \pst@@getcoor{#1}%
      \addto at pscode{\psarc at iv \psarc at v}%
      \gdef\psarc at type{0}%
      \showpointsfalse
    \fi
  \end at OpenObj%
}
\def\psarc at iv{%
  \pst at coor /y ED /x ED
  /r \pst at tempA \pst at number\psunit mul def
  /c 57.2957 r \tx at Div def
  /angleA
    \pst at tempa
    \psk at arcsepA c mul 2 div
    \ifcase\psarc at type add \or sub \fi
  def
  /angleB
    \pst at tempb
    \psk at arcsepB c mul 2 div
    \ifcase\psarc at type sub \or add \fi
  def
  \ifshowpoints\psarc at showpoints\fi
  \ifx\psk at arrowA\@empty
    \ifnum\psk at liftpen=2
      r angleA \tx at PtoC
      y add exch x add exch moveto
    \fi
  \fi}
\makeatother

\begin{document}

\begin{pspicture}(-3,-3)(3,3)
  \psarc[linewidth=1.2pt,arrows=->](0,0){2}{0}{180}
  \multido{\rt=10+10}{4}{%
     \psarc(!0 \rt\space 2 mul cos neg)%
         {\rt\space cos 2 mul}{\rt}{!180 \rt\space sub}%
}
\end{pspicture}

\end{document}

Herbert


More information about the PSTricks mailing list