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

Intersection exception #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

FabioTacke
Copy link

I use the library to calculate intersections of UIBezierPaths. In some cases I run into the BezierPathIntersectionException (mismatched intersection length) when intersecting paths with almost identical path segments.

I've added a test case that reproduces the exception. From briefly looking into the algorithm I don't understand what's going wrong here. I would be glad if you could take a look into it.

It might be the same issue as what's causing #9.

Thanks!

@FabioTacke FabioTacke changed the base branch from master to main February 15, 2022 16:02
@adamwulf
Copy link
Owner

Big thanks for the test case! I don't have time in the near-term to look into this, but when I finally do get time that test will be a big help. I think you're right that this is #9 as well.

@TianLong1989
Copy link

TianLong1989 commented Apr 14, 2022

This is big issue in my app. When can you see this bug and resolve problem?

@adamwulf
Copy link
Owner

Hi @TianLong1989, unfortunately I wont have time to fix this in the near term. Depending on your paths, you might be able to scale them up by 10 or 100, run the clipping, and scale the results back down. i know that's also not ideal, but could possibly resolve the issue for you in some cases.

@adamwulf
Copy link
Owner

test case from the Arclite referenced above:

(lldb) po textPath
path = UIBezierPath()
path.move(to: CGPoint(x: 148, y: 1422))
path.addLine(to: CGPoint(x: 148, y: 1456))
path.addLine(to: CGPoint(x: 153, y: 1456))
path.addLine(to: CGPoint(x: 153, y: 1422))
path.close()

(lldb) po wordPath
path = UIBezierPath()
path.move(to: CGPoint(x: 93.3019079008692, y: 1422.00000072504))
path.addLine(to: CGPoint(x: 93.3019079008692, y: 1467.087208519229))
path.addLine(to: CGPoint(x: 1164.245267275869, y: 1467.087208519229))
path.addLine(to: CGPoint(x: 1164.245267275869, y: 1422.00000072504))
path.close()

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

Successfully merging this pull request may close these issues.

3 participants