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

Curve curve intersection #195

Closed

Conversation

simoncozens
Copy link
Collaborator

As discussed in #194. Doesn't quite work.

The LineIntersections struct (and function) may go away after this is implemented, but I’m holding onto it for now.
Copy link
Contributor

@raphlinus raphlinus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not surprising this doesn't work well - when an intersection is extremely near a subdivision point, then due to floating point roundoff it's possible it can end up in both or neither of the subdivisions.

This is a legitimately tricky problem to get right, the robustness even more so than efficiency. It might be worth taking a look at the lyon code - and also might be good to know that we have permission to adapt that code as long as attribution is given (they adapted some of our flattening code).

@@ -825,6 +875,71 @@ impl PathSeg {
.sum()
}

/// Compute intersections between two `PathSeg`s
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we're going to allocate (for the box dyn), it's easier to just return a Vec here.

A non-allocating iterator is also possible, but makes the case analysis harder.

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.

2 participants