[pstricks] psRandom, dotsyle, and psBall
Herbert Voss
Herbert.Voss at FU-Berlin.DE
Thu Dec 1 11:29:46 CET 2016
Am 30.11.2016 um 19:04 schrieb Field, Malcolm:
> I am preparing a figure in which I use \psRandom to add a selected
> number of dots to a rectangle. However, I would like to use the same
> routine(s) with \psBall instead of dots because I want a 3D effect. Is
> there a way to do this? The basic code I am using is:
>
>
>
> \psRandom[dotsize=4.5ex,dotstyle=Circle,linecolor=black,fillcolor=green!80!blue!30,randomPoints=2000,fillstyle=solid](16,17){
>
> \psframe[linecolor=black](8.5,2.5)(13,10.5)}
>
>
>
> but I would like to replace “dotstyle=Circle” with “dotstyle=\psBall”
> although I know that if it is possible to use \psBall, it isn’t as
> simple as listed here.
Not possible with \psRandom, but:
\documentclass{article}
\usepackage{multido,pstricks-add,pst-slpe}
\begin{document}
\makeatletter
\pstVerb{
\psk at randInit srand % initializes the random generator
/getRandReal { rand 2147483647 div } def
}
\makeatother
\begin{pspicture}(-1,-1)(11,11)
\psframe*[linecolor=black!10](-1,-1)(11,11)
\multido{\iA=0+1}{100}{%
\psBall(! getRandReal 10 mul getRandReal 10 mul){blue}{3ex}}
\end{pspicture}
\end{document}
Herbert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Bildschirmfoto vom 2016-12-01 11-29-29.png
Type: image/png
Size: 76859 bytes
Desc: not available
URL: <http://tug.org/pipermail/pstricks/attachments/20161201/6dd5327e/attachment-0001.png>
More information about the PSTricks
mailing list