[pstricks] Fwd: Re: How to draw a \pspolygon with arbitrary arguments

Herbert Voss Herbert.Voss at FU-Berlin.de
Mon Apr 5 13:50:00 CEST 2010



-------- Original-Nachricht --------
Betreff: Re: How to draw a \pspolygon with arbitrary arguments
Datum: Mon, 05 Apr 2010 09:42:41 +0200
Von: Herbert Voss <Herbert.Voss at FU-Berlin.de>
Organisation: T-Online
Newsgruppen: comp.text.tex
Referenzen:
<1f1d7a12-fb67-47f9-908e-f6b16e7ce6fb at y14g2000yqm.googlegroups.com>
<4BB8E70F.2050105 at FU-Berlin.de>
<2fd9cb3c-6343-4f65-8df4-59814ce7e741 at u22g2000yqf.googlegroups.com>

Am 05.04.2010 07:02, schrieb chrishunter:

> But what I didn't write is that I also wish to make two other
> commands: One which takes two sets og arguments like
> 
> \recoverystarFilled(...)(...)
> 
> and then makes two stars with filling in between.
> 
> And one which takes four sets making two stars with filling in between
> and two other with filling in between on top of those.
> 
> Can I do that and how?

\documentclass{minimal}
\usepackage{pstricks}

\makeatletter
\define at key[psset]{}{innerRadius}[1]{\pst at getlength{#1}\psk at InnerRadius}
\psset{innerRadius=2cm}
\def\recoverystar{\pst at object{recoverystar}}
\def\recoverystar at i(#1){%
  \begin at ClosedObj
  \addto at pscode{
    /coor [#1] def
    coor length /no ED
    /angleunit { 360 no div mul } def
    /radius \psk at InnerRadius\space  def
    coor 0 get \pst at number\psrunit mul 0 moveto
    radius 0.5 angleunit PtoC lineto
    1 1 no 1 sub {
      /relAngle ED
      coor relAngle get \pst at number\psrunit mul relAngle angleunit PtoC
lineto
      radius relAngle 0.5 add angleunit PtoC lineto
    } for
    closepath
  }
  \end at ClosedObj%
}
\makeatother

\begin{document}

\psset{unit=0.5}
\begin{pspicture}(-10,-10)(10,10)
\recoverystar(3 6 9 2 5 8 1 4 7 10)
\recoverystar[innerRadius=1.5,fillcolor=red!30,fillstyle=solid,
    linecolor=blue](5 4 8 10 9 6 7 10)
\end{pspicture}

\end{document}


Herbert


More information about the PSTricks mailing list