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

Inconsistent arc union behavior #4

Open
alex-r-bigelow opened this issue Oct 8, 2024 · 1 comment
Open

Inconsistent arc union behavior #4

alex-r-bigelow opened this issue Oct 8, 2024 · 1 comment

Comments

@alex-r-bigelow
Copy link

Thanks for this awesome library!

Just reporting a few cases where very similar paths sometimes succeed, and sometimes fail, in case they're useful.

Note that, in order to actually see these paths on the demo page, tweaking the viewBox to be a bit bigger helps (these screenshots use 200x200).

I'll look closer at the code and attempt a PR in a bit. My first guess would be that there's a problem related to the SVG arc syntax itself, in that it's impossible to specify a 360-degree circle without breaking it into semicircles; see also: https://stackoverflow.com/a/10477334


Working Correctly

pathBoolean(
  'M68,39a32,32,0,1,0,-64,0a32,32,0,1,0,64,0',
  FillRule.NonZero,
  'M112,70a32,32,0,1,0,-64,0a32,32,0,1,0,64,0',
  FillRule.NonZero,
  PathBooleanOperation.Union)

image


The first path disappears, when the second is shifted slightly

pathBoolean(
  'M68,39a32,32,0,1,0,-64,0a32,32,0,1,0,64,0',
  FillRule.NonZero,
  'M102,70a32,32,0,1,0,-64,0a32,32,0,1,0,64,0',
  FillRule.NonZero,
  PathBooleanOperation.Union)

image


Union not performed, with another position

pathBoolean(
  'M68,39a32,32,0,1,0,-64,0a32,32,0,1,0,64,0',
  FillRule.NonZero,
  'M105,73a32,32,0,1,0,-64,0a32,32,0,1,0,64,0',
  FillRule.NonZero,
  PathBooleanOperation.Union)

image

alex-r-bigelow added a commit to alex-r-bigelow/PathBool.js that referenced this issue Oct 8, 2024
alex-r-bigelow added a commit to alex-r-bigelow/PathBool.js that referenced this issue Oct 8, 2024
@alex-r-bigelow alex-r-bigelow mentioned this issue Oct 8, 2024
6 tasks
@r-flash
Copy link
Owner

r-flash commented Oct 9, 2024

Thank you so much for contributing! Let me know if you have any problems understanding the code. Thorough commenting and explanation of the code is still a TODO unfortunately. I'll look into your reported bugs too.

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