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?
Best Answer
I'm going to partially answer this myself since I found a method that works for an unbranched line segment, however I'm still not sure how to go about a branched line segment as in my original question.