-
Notifications
You must be signed in to change notification settings - Fork 63
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
segmentSegment can fail to terminate on very specific and seemingly innocuous inputs #323
Comments
I can reproduce the issue. Tracking it down further now. |
We can make |
It looks like there are significant changes in the Here are some of the issues I see in
A broader issue with import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine
b = fromSegments [bezier3 (V2 4 0) (V2 1 3) (V2 1 (-1))] :: Located (Trail V2 Double)
b1 = stroke $ section b 0.0 0.6 :: Diagram B
b2 = stroke $ section b 0.4 1.0 :: Diagram B
main = mainWith . pad 1.1 . lw 7.0 $ mconcat
[ b1 # lcA (blue `withOpacity` 0.5)
, b2 # lcA (red `withOpacity` 0.5)
] I think for this example it is clear what we would ideally want, |
I think "overlaps within epsilon" aught to have to same behaviour as precise overlap because "precise" is going to be often be fuzzy do to floating point math anyway and otherwise we run into the problem of sectionSection trying to return a huge set of points along the overlap. |
I imagine having two functions: data Intersection n = IPoint n n | IOverlap (n,n) (n,n)
segmentSegmentPoints :: OrderedField n
=> n -- epsilon in the parameter space
-> FixedSegment V2 n
-> FixedSegment V2 n
-> [Intersection n]
segmentSegmentOverlaps :: OrderedField n
=> n -- epsilon in V2 Euclidean space
-> FixedSegment V2 n
-> FixedSegment V2 n
-> [Intersection n] The |
Slight perturbations of d and r avoid the bug, as does increasing e (default 1e-8).
The text was updated successfully, but these errors were encountered: