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
![image](https://private-user-images.githubusercontent.com/36081997/355922376-8878bd03-3cdf-4d52-bc27-cf3f9d544bc1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5NzY4NjksIm5iZiI6MTcyMzk3NjU2OSwicGF0aCI6Ii8zNjA4MTk5Ny8zNTU5MjIzNzYtODg3OGJkMDMtM2NkZi00ZDUyLWJjMjctY2YzZjlkNTQ0YmMxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDEwMjI0OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJlZmIyZGM2YWNhZjY0NjQxMjRmNmEwNzZmNTExOTI5ZDMwYTIyOWRkZWNhYzJkMDIzYmZjZjdhZDRkZThlZWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.ZuMLFf6tRlZ3UrbKk71i68hISUtfMxiQh66byiX61EI)
perfect precision 6
![image](https://private-user-images.githubusercontent.com/36081997/355923636-59388ceb-cd8e-4397-a4eb-4101d94de5e1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5NzY4NjksIm5iZiI6MTcyMzk3NjU2OSwicGF0aCI6Ii8zNjA4MTk5Ny8zNTU5MjM2MzYtNTkzODhjZWItY2Q4ZS00Mzk3LWE0ZWItNDEwMWQ5NGRlNWUxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDEwMjI0OVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMwMjliMWZlZWY3YmNmMzhjNmZhZGM2ZmI2OWEyNzU5NzZiNTU5ZDFmM2MxMTMwMTNkOTAxYTNjMjU4NzcyNzUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.1jR3VaB5vcIzAzFLzmDCC6IuviPnCESc3w1_DmPBiW4)
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...