I’m trying to calculate the area of a curve with a certain thickness. Is not really a problem until you get into self-intersecting curves and have to take into consideration overlapping regions. I tried to approximate the thick curve populating the curve with circles and then using rs.CurveBooleanUnion which works but is very slow.
Here’s another way, that splits the self-intersecting curve into open and closed pieces, offsets these pieces, and joins all the resulting regions to get a “thickened curve”. It works for non-self-intersecting curves too, but you’ll probably have to do some tree management if you want it to work on multiple curves.
With another round of the trick “Region Difference of (Region Union - Region Intersection)”, I seem to get reasonable results on curves with multiple self intersections.
Another completely different idea would be to pipe the curve, intersect it with the xOy plane, and approximate the area of the thickened curve from that. My first try failed because the area around the intersections is counted multiple times, but there surely is a way to repair that!
I tried before with a loose offset to get an overlapping close curved, which gives more or less the same result as the pipe section. I guess one can try multiple curve boolean based on the centres of the inside regions of the curve, pretty much the same logic you used.
This ended up being an interesting problem, now I’m wondering if there is a way to tell if certain region is overlapping more than once. Like you would expect using a transparent brush in photoshop.