offset-polygon
offset-polygon copied to clipboard
Problems in coordinate axis arrays
I applied it in the Threejs project and found that some of them were not extended but contracted.
(This is a Chinese translation)
The contracted data is:
[-14, -6], [-8, -6], [-8, -8], [-6, -8], [-6, -14], [-16, -14], [-16, -8], [-14, -8]],
[6, -7], [7, -7], [7, -6], [12, -6], [12, -7], [13, -7], [13, -12], [12, -12], [12, -13], [7, -13], [7, -12], [6, -12]]
Hey, Have in mind that this is a very simple library which I'm not maintaining anymore, since I found the excellent js-angusj-clipper. It is really robust and I can wholeheartedly recommend it. Here is ofsetting documentation.
Anyway, I re-created your examples in CodeSandbox - https://codesandbox.io/p/sandbox/offset-polygon-issue-4-4f6m8f
From I can see, with offset set to 1, it works as expected:
Of course if you increase offset to something larger than the polygon (in this case 3), library will go bonkers:
Hope that helps, cheers!
EDIT: Now I think I didn't really respond to your question. If the issue is that offset param is behaving differently, try changing the orientation of the polygon (or multiply offset by -1).