Let's say I have a set of vertices connected by edges to form a polygonal chain. Each vertex may be shared by a number of edges to form various sub-chains. An example is shown below.

Each edge has a value of thickness attached to it. I then extrude the chain along the normal of each edge by an amount determined by the edges's thickness, to form a closed polygon. Extruding around each edge individually leads to overlapping and empty wedges however, as shown below.

I'm looking for a way to create a single, closed simple polygon from this method. Gaps and overlaps can be resolved by finding the intersection points of the formed rectangles, although this doesn't explain how I should actually go about solving the problem in more complicated scenarios. For example, the rectangles formed in the star structure shown have many intersection points with each other. What I'd like is something that looks like this:

Does an algorithm exist to generate such a polygon from a connected set of vertices in this way? If not, what is the best way to approach the problem?



This algorithm is built in 2D graphics systems that can handle line joins, such as SVG, PostScript, PDF, and many others. There are several options. See this Wolfram Demonstration.
However, graphics systems do not necessarily convert thick lines into simple polygons, because they only need to paint the corresponding pixels.
Even for simple polylines, converting thick lines into simple polygons is not a very simple task.