StipplePoly

StipplePoly is a function which allows you to generate a "transparent" polygon which can then be displayed using Show.  The function takes three required arguments, the center of the polygon, the circumscribe radius of the polygon, and the number of sides.  The fourth argument is the color, which if not specified is a dark gray by default.  Any of the standard color specifications, GrayLevel, RGBColor, CMYKColor or Hue, in Mathematica will work.

StipplePoly[center_, radius_, sides_, color_:  GrayLevel[ .3]]  :=  
      Module[{lineMaker, vertices, outline, workingverts, boundaries, pts, 
          conds, poly}, 
lineMaker[{x1_, y1_}, {x2_, 
              y2_}, {x_, y_}]  :=  
          If[x1 == x2, -x2  +  x, 
            Collect[(y2 - y1)/(x2 - x1) (x  -  x1)  - (y - 
                    y1), x]]; 
vertices  =  
          Table[{radius Cos[t], radius Sin[t]}, {t, 0. , 2 π, 
              2 π/sides}]; 
outline  =  
          Map[#  +  center &, 
            vertices]; 
workingverts  = 
          Take[ Partition[ vertices, 2, 1], 
            Ceiling[sides/2]]; 
boundaries[p_, q_]  = 
          Apply[lineMaker[#1, #2, {p, q}] &, 
            workingverts, {1}]; 
pts  = 
          Table[{Random[Real, { -radius, radius}], 
              Random[Real, {0, radius}]}, {i, 
              radius 4000}]; 
conds[{p_, q_}]  =  
          Apply[And, 
            Map[#[[1]] ≥ -Rest[#] &, 
              boundaries[p, q]]]; 
prepoly  = 
          Select[pts, conds[#] &]; 
polytop  =  
          Map[# + center &, prepoly]; 
polybot  =  
          Map[{1, -1} #  +  center &, 
            prepoly]; 
poly  = {color, PointSize[ .004], 
            Line[outline], 
            Point /@  Join[polytop, polybot]}
]

Comments

StipplePoly always makes the axis of symmetry horizontal.  This could be modified in the last step by including a rotation matrix but this will slow the function down, because of the large number of points involved.  The density of the plots could also be changed by altering the 4000 in the pts line to a smaller (less dense) or larger (more dense) number.  More points will make the function run slower.

An example

Here we create four polygons to plot.

mypoly1  =  StipplePoly[{1, 1}, 1, 5, Hue[ .95]];

mypoly2 =  StipplePoly[{2, 1.6}, 1.5, 7, Hue[ .7]];

mypoly3  =  StipplePoly[{ .5, 1.8}, 1.4, 6, Hue[ .8]];

The plot

Show[Graphics[{mypoly1, mypoly2, mypoly3}], 
      AspectRatio  ->  Automatic, Axes  ->  True, 
      Background  ->  GrayLevel[ .85], 
      ImageSize  ->  480]