There is a vector polygon in the program (in the form of drawing commands).
The task is to expand this polygon in all directions by a specified distance. That is, to get its contour or frame, taking into account possible internal collisions. Interested, in fact, the algorithm of this action. It is desirable, not particularly resource-intensive. Or just a literature where you can read about it.
The most interesting thing is:
- processing of self-intersections in closed areas (like an internal hole in the letter "I" - filled completely).
- rounding in the corners. How to do without rounding is more or less clear (draw parallel lines at a given distance). Or do you connect the ends of the segments with the help of a bezier? ..
Black is the source area, and blue is the final (for different contour thickness). In extreme cases, you can build on the finished raster of the original polygon.