8000 Funniness with cubic/line intersection (when negative values present?) · Issue #411 · linebender/kurbo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Funniness with cubic/line intersection (when negative values present?) #411
Open
@cmyr

Description

@cmyr

Maybe I'm holding it wrong, but I've run into a funny case where PathSeg::intersect_line is returning suspicious results. I'll include an SVG below showing the issue, which is reproducible with the following test case:

    #[test]
    fn test_intersect_wat() {
        let c: PathSeg = CubicBez::new(
            (452.0, 240.0),
            (462.667, 78.667),
            (480.667, -146.333),
            (506.0, -435.0),
        )
        .into();
        let line = Line::new((385.0, 146.0), (438.0, 243.0));
        
        let hits = PathSeg::from(c).intersect_line(line);
        assert!(hits.is_empty());
    }

(this reports a hit, which it should not.)

If I nudge the segments so that all the points are positive, the issue goes away, Which leads me to the guess that this is some subtle mishandling of sign, somewhere?

for illustration the segments look like this (with the reported hit shown as a dot at the relevant t of each segment)

wat

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0