Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems in coordinate axis arrays #4

Open
hucoooo opened this issue Feb 4, 2024 · 2 comments
Open

Problems in coordinate axis arrays #4

hucoooo opened this issue Feb 4, 2024 · 2 comments

Comments

@hucoooo
Copy link

hucoooo commented Feb 4, 2024

I applied it in the Threejs project and found that some of them were not extended but contracted.
(This is a Chinese translation)
image

@hucoooo
Copy link
Author

hucoooo commented Feb 4, 2024

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]]

@Stanko
Copy link
Owner

Stanko commented Feb 4, 2024

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:
Screenshot 2024-02-04 at 11 47 34

Of course if you increase offset to something larger than the polygon (in this case 3), library will go bonkers:
Screenshot 2024-02-04 at 11 47 28

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants