Wide Line Geometry

 from Red Blob Games
3 Oct 2023

Problem: we have a polyline (linked line segments) and want to turn this into a polygon with some width. Here's the demo:


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

Email me , or tweet @redblobgames, or comment: