3 edited tags
| link
    Tweeted twitter.com/#!/StackMma/status/185926060720926720
2 edited title
| link

Filling a Polygonpolygon with a Patternpattern of Insetsinsets

source | link

Filling a Polygon with a Pattern of Insets

I am trying to fill a shape with diagonal lines. I am aware of Texture, but it rasterizes the fill pattern, which is not desirable. Here was my crack at it:

Graphics[{FaceForm[White], EdgeForm[Black], 
  Polygon[{{0, 0}, {1, 0}, {1, 1}, {0.5, 1.5}, {0, 1}}], 
    Inset[Graphics[Line[{{0, 0}, {1, 1}}]], {0, 0.1 l}, {0, 0}, 
     Scaled[{1, 1}]], {l, -10, 10}]}]

Which produces the following:

enter image description here

Ideally, I would want to just clip the insets such that they do not appear outside of the shape, rather than having to calculate the intersection between the lines and the polygon (for which I have shown a relatively simple example, in principle I'd like this to work for more complicated shapes such as FilledCurve). Note that there is a very large whitespace around the figure as well, which only appears when I include the insets.