[pstricks] Drawing "real" circle-like stain
Herbert Voss
Herbert.Voss at alumni.TU-Berlin.DE
Sat Nov 13 21:03:55 CET 2004
Christophe Jorssen wrote:
>
> I'm looking for some code that could fake a stain. It's for drawing a "real"
> chromatography diagram.
>
> I had a look at
>
> http://www.complex.unifi.it/twiki/bin/view/Software/PSTDisegniManuali
>
> but I'd like to have a command like
>
> \pstStain that would take the same argument as \pscircle.
the options are selfexplanatory
Herbert
\documentclass[a4paper,10pt]{article}
\usepackage{pstricks}
\usepackage{pst-xkey}
\makeatletter
\define at key[psset]{}{stain}{\def\psk at stain{#1}}
\define at key[psset]{}{step}{\def\psk at step{#1}}
\define at key[psset]{}{stRadius}{\def\psk at stRadius{#1}}
\psset{stain=3,step=0.25,stRadius=0.5}% step in degrees, the other in pt
%
\def\psCStain{\pst at object{psCStain}}
\def\psCStain at i(#1)#2{{%
\begin at ClosedObj
\use at par%
% \pscircle(#1)#2
\pst at getcoor{#1}\pst at tempa%
\pssetlength\pst at dimc{#2}%
\def\pst at linetype{4}%
\addto at pscode{%
rrand srand
/getRandInt { rand 2147483647 div 2 mul 1 sub \psk at stain\space mul
} def
% gsave
\pst at tempa\space translate pstack
/radius \pst at number\pst at dimc \psk at dimen CLW mul sub def
0 \psk at step\space 360 {
/angle exch def
radius getRandInt add dup angle cos mul exch angle sin mul
\psk at stRadius\space 0 360 arc fill
} for
stroke
% grestore
}%
\end at ClosedObj
}}
\makeatother
\begin{document}
\begin{pspicture}(5,5)\psgrid[griddots=5,subgriddiv=0]
\psCStain(2.5,2.5){2.5}
\end{pspicture}
--
http://TeXnik.de/
http://PSTricks.de/
ftp://ftp.dante.de/tex-archive/info/math/voss/Voss-Mathmode.pdf
http://www.dante.de/faq/de-tex-faq/
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes
More information about the PSTricks
mailing list