# Proper EdgeForm setting so boundary appears entirely within shape

I have two neighboring (complicated) polygons that I want to be displayed with thick boundaries, however the two shapes border one another, and as EdgeForm places the line centered upon the polygon's boundary, the border of one shape overlaps the other. I would like the boundary lines to lie interior to the polygon's boundaries.

Here's shape 1, shape 2, and then the two shapes shown together:

Obviously one could just shrink the shapes by a little bit, but this is not very exact. I was thinking a clever EdgeForm definition might be able to "offset" the boundary to the shape's interior.

• I have wanted this myself but I have never found a solution within EdgeForm itself. I too have ended up shrinking shapes to make them fit. As far as I know Mathematica lacks the "inside stroke" method that you describe. Once again I hope I am proven wrong. :-) Aug 25 '14 at 7:40

This is probably the simplest approach, but it only works with AspectRatio -> Automatic, and the thickness seems to be constant in an $L^1$-sense rather than $L^2$.

p1 = Polygon[{{-1, 0}, {1, 0}, {0, 1}}];
p2 = Polygon[{{-1, 0}, {1, 0}, {0, -1}}];

With[{t = 0.94}, Show[Graphics[{
{Red,   p1, White, Scale[p1, t], Red,   Opacity[1/3], Scale[p1, t]},
{Green, p2, White, Scale[p2, t], Green, Opacity[1/3], Scale[p2, t]}}]]]


• With FilledCurve you can exclude regions from polygon: "Self-intersecting curves are filled according to an even-odd rule that alternates between filling and not at each crossing. FilledCurve[{component1, component2, ...}] treats each component curve as a separate closed curve, but the filling behavior is determined as if they were part of the same curve." Feb 20 '17 at 11:46
• An example: FilledCurve[{{Line[{{-1, -1}, {-1, 1}, {1, 1}, {1, -1}}]}, {Line[.9 {{-1, -1}, {-1, 1}, {1, 1}, {1, -1}}]}}]. Feb 20 '17 at 11:48
• With Offset coordinates the shape will be independent from AspectRatio. Feb 20 '17 at 11:50
• While this is close, it's certainly not perfect, the difference in line thickness between the different sides can be quite noticeable: i.imgur.com/fb5U4SQ.png Feb 22 '17 at 0:38