I am not sure this is a bug or a fault on my side yet, it takes place when offsetting complex overlapping polygons using union (winding rules used). According to the clipper2 official documentation:
https://angusj.com/clipper2/Docs/Units/Clipper.Offset/Classes/ClipperOffset/_Body.htm
I have used both union and inflate to make a buffer zone across an overlapping polygon. The issue is that when using precision more than 6, the offset gets scrambled.
static public clipper2.core.PathD doOffsetMethodClipper2(clipper2.core.PathD p, double offset_nm) {
clipper2.core.PathsD solution = new clipper2.core.PathsD();
if (offset_nm == 0) {
return p;
} else {
clipper2.core.PathsD pths = new clipper2.core.PathsD();
pths.add(p);
pths = clipper2.Clipper.Union(pths, pths, FillRule.NonZero, 8); // UNION ON OVERLAPPING POLYGONS WITH PRECISION
solution = clipper2.Clipper.InflatePaths(pths, offset_nm , JoinType.Miter, EndType.Polygon, 15, 8); // precision breaks results if >6 WHY?
...
}
pathD objects are being created from multi point overlapping path2D using double coordinates and a series of conversion methods that all use double point2D.Double and path2D.Double
scrambled precision 8
perfect precision 6
setting precision to 6 everything looks normal. Looks like a float casting but I cannot find any of those in my coordinates. There could be some kind of precision reduction somewhere in the clipper, clipperD class? Regards...