You will need two types of offset algorithms :
- Offset curve in both directions to create a track
- Offset a closed curve inward to create one or more smaller closed polygons.
Let r be the distance to the red line, b be the desired wall thickness between the black lines / tracks.
- Reset the red line to r using algorithm 1. This may cause the track to overlap, i.e. has "blob-like" areas.
- Offset the red line using algorithm 2. Use the binary search to find the distance d at which the shape is split into two or disappears. If d> b, then an inward shift by d - b to create a second region. Otherwise, the algorithm fails.
- Subtract the second area from the first.
source share