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:

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}

https://web.archive.org/web/20120626185810/https://forum.libcinder.org/topic/smooth-thick-lines-using-geometry-shader[1]

Source: wide-line-geometry.js

Email me , or tweet @redblobgames, or comment: