I'm trying to create or locate an algorithm to render the "+/- leeway" around a two-dimensional vector line. The horizontal and vertical leeway values are arbitrary, as is the line's path (although it will not overlap or loop back on itself).
--
Here are some diagrams to help the above make sense:
The first diagram shows the original line, with the control points marked with dots.
The second diagram shows "leeways" around each control point; in this case the allowed variation in the vertical direction is about twice the allowed variation in the horizontal direction, creating a rectangle around each point.
As a last resort I could just render each of those rectangles, and join them up to make the leeway "volume" continuous. The third diagram connects corner lines to each rectangle, which shows that the volume I'm aiming for is contained within all the quads and various surfaces that could be created by connecting the quads together.
I call that a last resort because I need this to be as fast as possible, meaning that I need the simplest geometry possible. This example has less than 20 control points, but I could be dealing with lines that contain thousands.
The fourth diagram shows that the simplest geometry is found by tracing the very outermost corners above and below the line. Although the two corners that are < 90 degrees have locations that are not at the corner of a rectangle (they're at the intersection of two lines).
Finally, the last diagram shows what I'm aiming for, with the lines of the previous diagram easily turned into a strip of triangles suitable for rendering with OpenGL or whatever.
--
I've been trying to figure out some rules to define the two lines of diagram 4, without success so far.
Any thoughts appreciated.