[pstricks] almost closed c with pstricks

mathias legrand legrand.mathias at gmail.com
Sat Jul 17 13:40:20 CEST 2010


> Hi all,
>
> is there a specific known manner to create example 53 (beginfig(53))
> of the following webpage :
> http://zoonek.free.fr/LaTeX/Metapost/metapost.html
> with pstricks. I know how to draw it with some personal tricks but I feel
> there is much better.
>
> Thank you
>
>
> ------------------------------
>
> Message: 5
> Date: Fri, 16 Jul 2010 20:49:06 -0700
> From: Herbert Voss<Herbert.Voss at FU-Berlin.DE>
> To: pstricks at tug.org
> Subject: Re: [pstricks] almost closed c with pstricks
> Message-ID:<4C412832.5010301 at FU-Berlin.DE>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Am 16.07.2010 20:00, schrieb mathias legrand:
>
>    
>> is there a specific known manner to create example 53 (beginfig(53))
>> of the following webpage :
>> http://zoonek.free.fr/LaTeX/Metapost/metapost.html
>> with pstricks. I know how to draw it with some personal tricks but I feel
>> there is much better.
>>      
> \documentclass{article}
> \parindent0pt
> \pagestyle{empty}
> \usepackage{pstricks}
>
> \begin{document}
> \begin{pspicture}(-2,-2)(2,2)
> \pscustom[fillstyle=eofill,fillcolor=blue!30]{%
>    \psarc(0,0){2}{2}{358}
>    \psline(2,-0.05)(0.5,-0.05)
>    \psarcn(0,0){0.5}{352}{8}
>    \psline(0.5,0.05)(2,0.05)
> }
> \end{pspicture}
> \end{document}
>
> Herbert
>
>
>
> ------------------------------
>
> Message: 6
> Date: Fri, 16 Jul 2010 21:15:50 -0700
> From: Herbert Voss<Herbert.Voss at FU-Berlin.DE>
> To: pstricks at tug.org
> Subject: Re: [pstricks] almost closed c with pstricks
> Message-ID:<4C412E76.6010508 at FU-Berlin.DE>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Am 16.07.2010 20:49, schrieb Herbert Voss:
>    
>> Am 16.07.2010 20:00, schrieb mathias legrand:
>>
>>      
>>> is there a specific known manner to create example 53 (beginfig(53))
>>> of the following webpage :
>>> http://zoonek.free.fr/LaTeX/Metapost/metapost.html
>>> with pstricks. I know how to draw it with some personal tricks but I feel
>>> there is much better.
>>>        
> or a more general one. .5 and 2 for the radii can also be set
> as \def\r{0.5 } and \def\R{2 }
>
> \documentclass{article}
> \parindent0pt
> \pagestyle{empty}
> \usepackage{pstricks,pst-math}
> \SpecialCoor
>
> \def\Rr{4 }
> \def\Alpha{357 }
>
> \begin{document}
> \begin{pspicture}(-2,-2)(2,2)
> \pscustom[fillstyle=eofill,fillcolor=blue!30]{%
>    \psarc(0,0){2}{!360 \Alpha sub}{\Alpha}
>    \psline(2;\Alpha)(0.5,0|2;\Alpha)
>    \psarcn(0,0){0.5}{!\Alpha sin \Rr mul ASIN RadtoDeg}
>                     {!360 \Alpha sub sin \Rr mul ASIN RadtoDeg}
>    \psline(!0.5 360 \Alpha sub sin \Rr mul ASIN RadtoDeg PtoC)
>           (!2 360 \Alpha sub PtoC)
> }
> \end{pspicture}
> \end{document}
>
> Herbert
>
>
> ------------------------------
>
> Message: 7
> Date: Fri, 16 Jul 2010 22:00:01 -0700
> From: Michael Sharpe<msharpe at ucsd.edu>
> To: Graphics with PSTricks<pstricks at tug.org>
> Subject: Re: [pstricks] almost closed c with pstricks
> Message-ID:<103FEFF1-F8C5-4CE1-B129-97A7418E703F at ucsd.edu>
> Content-Type: text/plain; charset=us-ascii
>
>
> On Jul 16, 2010, at 8:00 PM, mathias legrand wrote:
>
>    
>> Hi all,
>>
>> is there a specific known manner to create example 53 (beginfig(53))
>> of the following webpage : http://zoonek.free.fr/LaTeX/Metapost/metapost.html
>> with pstricks. I know how to draw it with some personal tricks but I feel
>> there is much better.
>>      
> The version below works for (almost) arbitrary choices of radii and linewidth, without performing calculations other that the correct radii for clipping.
>
> \documentclass[dvips]{minimal}
> \usepackage[dvipsnames]{pstricks}
> \begin{document}
> \begin{pspicture}(-2.5,-2.5)(2.5,2.5)
> \newdimen\lw\lw=2pt\relax
> \newdimen\halflw\halflw=\lw \divide\halflw 2\relax
> \newdimen\outerr\outerr=2cm\relax
> \newdimen\innerr\innerr=.5cm\relax
> \newdimen\outerclipr\outerclipr=\outerr
> \advance\outerclipr\halflw
> \newdimen\innerclipr \innerclipr=\innerr\advance\innerclipr-\lw
> \pscircle*[linewidth=0pt,linecolor=black!20](0,0){\the\outerr}% gray filled circle
> \psset{linewidth=\lw}
> \pscircle(0,0){2}% outer circumference in black
> \pscircle(0,0){.5}% inner circumference in black
> \psclip{\pscircle[linestyle=none](0,0){\the\outerclipr}}
> \psframe[fillstyle=solid,fillcolor=white](0,-.1)(2.5,.1)\endpsclip
> \pscircle*[linecolor=white](0,0){\the\innerclipr}
> \end{pspicture}
> \end{document}
>
> Michae


Thank you both, very nice solutions!



More information about the PSTricks mailing list