I have a 2D array of values that map to coordinates, and a set of lines that pass through some of those coordinates. I want to be able to change the values in the array based on their proximity to these lines. So basically I need a line-drawing algorithm, but which supports arbitrary widths.
An algorithm like the Bresenham line-drawing algorithm would be fine if the line had essentially zero thickness, but the thickness varies from line to line and I'm not sure how I'd extend it to handle that.
I'm also aware that I could treat the line as a rectangle and fill that in, but it sounds suspiciously like implementing half of a software renderer which I'm not keen on doing, unless there is some very simple code or pseudocode that I can pretty much just drop in.
I currently have an interesting inverted solution, where I take each point in the array and calculate the distance from that point to the nearest line, and if that distance is less than the line's thickness, then the point is filled in. This has the beneficial effect of letting me taper off the values further from the line, giving me a nice gradient at the edges and avoiding aliasing as well. It also has the detrimental effect of being very slow, even with all the square roots removed from the distance calculations. There are too many redundant distance calculations against lines which turn out not to be the nearest one and thus not contributing to the final distance. But if I could speed this up I'd be happy to stick with it.