summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pstricks/voss/bsp101.tex
blob: c9d2ced8dbe4881f09510c4a697a3f41522e6d72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
\documentclass[a4paper]{article}
\usepackage{multido}
\usepackage{pstricks}

\input{random.tex}% From Donald Arseneau (CTAN:macros/generic/random.tex)

\newcount\NumberDots
\newdimen\DotSize
\newdimen\Hue
\newdimen\XPos
\newdimen\YPos

% Circle with dots at random positions
\def\CircleWithDotsA#1#2{%
% #1=radius of the circle
% #2=number of dots (put on the (-#1,-#1)(#1,#1) square,
%    not on the circle itself!)
\pspicture(-#1,-#1)(#1,#1)
  \setrannum{\NumberDots}{0}{#2}%
  \psclip{\pscircle{#1}}
    \multido{\iDots=1+1}{\NumberDots}{%
      \setrandim{\XPos}{-#1 pt}{#1 pt}%
      \setrandim{\YPos}{-#1 pt}{#1 pt}%
      \psdot(\pointless\XPos,\pointless\YPos)}
  \endpsclip
\endpspicture}

% Circle with dots at random positions, with random dot sizes
\def\CircleWithDotsB#1#2{%
% #1=radius of the circle
% #2=number of dots (put on the (-#1,-#1)(#1,#1) square,
%    not on the circle itself!)
\pspicture(-#1,-#1)(#1,#1)
  \setrannum{\NumberDots}{0}{#2}%
  \psclip{\pscircle{#1}}
    \multido{\iDots=1+1}{\NumberDots}{%
      \setrandim{\XPos}{-#1 pt}{#1 pt}%
      \setrandim{\YPos}{-#1 pt}{#1 pt}%
      \setrandim{\DotSize}{2pt}{15pt}%
      \psdot[dotsize=\DotSize](\pointless\XPos,\pointless\YPos)}
  \endpsclip
\endpspicture}

% Circle with dots at random positions, with random dot sizes
% and random colors
\def\CircleWithDotsC#1#2{%
% #1=radius of the circle
% #2=number of dots (put on the (-#1,-#1)(#1,#1) square,
%    not on the circle itself!)
\pspicture(-#1,-#1)(#1,#1)
  \setrannum{\NumberDots}{0}{#2}%
  \psclip{\pscircle{#1}}
    \multido{\iDots=1+1}{\NumberDots}{%
      \setrandim{\XPos}{-#1 pt}{#1 pt}%
      \setrandim{\YPos}{-#1 pt}{#1 pt}%
      \setrandim{\DotSize}{2pt}{15pt}%
      \setrandim{\Hue}{0pt}{1pt}%
      \definecolor{MyColor}{hsb}{\pointless\Hue,0.6,1}
      \psdot[dotsize=\DotSize,linecolor=MyColor]
            (\pointless\XPos,\pointless\YPos)}
  \endpsclip
\endpspicture}

\pagestyle{empty}
\parindent=0pt

\begin{document}

% To fix the random seed (otherwise the clock is used)
\randomi=123456

\CircleWithDotsA{1}{10}
\psset{dotstyle=o}
\CircleWithDotsA{1}{50}
\psset{dotstyle=*}
\CircleWithDotsA{1}{100}
\psset{dotstyle=square}
\CircleWithDotsA{1}{1000}
\psset{dotstyle=square*}
\CircleWithDotsA{1}{3000}

{\psset{dotscale=3,dotstyle=x}\CircleWithDotsA{3}{500}} % Bigger fixed dots

\psset{dotstyle=+}
\CircleWithDotsB{2}{10}
\psset{dotstyle=B+}
\CircleWithDotsB{2}{100}
\CircleWithDotsB{2}{200}

\psset{dotstyle=|}
\CircleWithDotsC{2}{10}
\psset{dotstyle=x}
\CircleWithDotsC{2}{100}
\psset{dotstyle=oplus}
\CircleWithDotsC{2}{500}


\end{document}