Odd "cutouts" in Polygon when using OffsetPolygon from Angus Johnsons Clipper lib

enter image description here

The ultimate goal of this code is to make sure that the client defines the forms that can actually be processed by our ... machines. To do this, we compensate for the indicated shape inward with the radius of the bit, and then return the same value back, thereby rounding up any parts that would be too thin to actually insert the bit into. For polygonal correction, we use the Angus Johnson Clipper library, version 5.1.6 (C ++).

But, as can be seen in the picture, this leads to some unexpected forms. In the picture, I compensated for the original shape (green, mostly covered with a later pattern) using -radius, using ClipperLib::OffsetPolygon to get a yellow shape, and then compensate for the radius to get a red shape.

In theory, this should lead to the fact that the red form is fully consistent with the green form for the case shown in the link.

What could be wrong to make the result higher?

+6
source share
1 answer

I had these artifacts as well, and in my case CleanPolygons () allowed this before each offset operation. The problem was related to micro-self-intersections and / or duplicate points, which can be solved using the mentioned cleaning function.

+3
source

Source: https://habr.com/ru/post/959193/


All Articles