Problem: we have a polyline (linked line segments) and want to turn this into a polygon with some width. Here's the demo:
Solution:
For each line segment, construct a rectangle
TODO: show the calculations visually
TODO: rectangles could be split if we want to attach additional information to the vertices {they currently are split}
TODO: miter, bevel, round line joins {currently miter}
TODO: butt, square, round line caps {currently round}
Source: wide-line-geometry.js