I saw this diagram on an exam paper and noticed that it was too clean to have been made in the usual MS Word program. So I figured that it may have been made in either TikZ or PSTricks.

What stood out for me was the method of shading the region, which was to use a 'dotted background' as opposed to the usual grey paint. Is this something possible in either TikZ or PSTricks? I have never seen it before in either of the two, but perhaps you may have. I can't imagine somebody manually assigning dots coordinate by coordinate.

enter image description here


Here's a pattern I defined by taking the coordinates from your image. One could probably use some external program such as octave or the scripting capabilities of luatex to generate new points.

Just taking purely random points doesn't really work, because those won't be distributed evenly enough.



\pgfdeclarepatternformonly{spray}{\pgfpoint{-\sprayRadius}{-\sprayRadius}}{\pgfpoint{1cm + \sprayRadius}{1cm + \sprayRadius}}{\pgfpoint{\sprayPeriod}{\sprayPeriod}}{
    \foreach \x/\y in {2/53,6/52,11/48,23/49,20/47,32/46,41/47,47/51,56/52,46/44,4/43,16/42,33/41,41/37,49/35,55/31,37/35,44/30,28/37,24/36,17/37,7/38,0/31,8/29,18/31,28/30,37/28,30/27,46/24,51/21,24/23,12/24,4/21,18/19,12/16,31/21,38/18,26/16,46/16,56/12,52/10,45/8,51/4,37/12,35/7,24/9,14/9,2/12,8/6,15/4,27/0,34/1,40/1} {
        \pgfpathcircle{\pgfpoint{(\x + random()) / 57 * \sprayPeriod}{\sprayPeriod - (\y + random()) / 55 * \sprayPeriod}}{\sprayRadius}
    %\foreach \i in {1,...,100} {
    %   \pgfpathcircle{\pgfpoint{1cm * random()}{1cm * random()}}{\sprayRadius}

        \filldraw[pattern=spray] (0,0) -- (3,3) -- (2,3) -- cycle;


| improve this answer | |



enter image description here

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.