Skip to content

Bug in Line Intersection ( GeometryBasics.intersects ) #168

Closed
@mherreshoff

Description

@mherreshoff

I found a pair of lines that GeometryBasics.intersects claims don't intersect even though they do. How to reproduce:

I'm using Julia 1.7.2 with [5c1252a2] GeometryBasics v0.4.1

If you run the following code

using GeometryBasics
const GB = GeometryBasics
mkline(pair) = GB.Line(GB.Point(pair[1]...), GB.Point(pair[2]...))
bug2 =(mkline([-3.1, 15.588457268119894] => [3.1, 15.588457268119894]),
    mkline([2.0866025403784354, 17.37050807568877] => [-4.0866025403784505, 13.806406460551015]))
GB.intersects(bug2[1], bug2[2])

I get (false, [0.0, 0.0]) even though these lines should intersect. To confirm that they do I've drawn the lines using the Luxor package here: https://imgur.com/a/3sADDln

Drawing code for ease of copy paste:

using Luxor
@draw begin
    LP = Luxor.Point
    dscale=10
    setline(1)
    sethue("black")
    for (p1, p2) in bug2
        asp(p) = let 
            v = ([dscale, -dscale] .* vec(p))
            @show v
            Luxor.Point(v...)
        end
        line(asp(p1), asp(p2); action=:stroke)
    end
end

Anyway, thanks for having made the geometry package, and I'll be curious to see what the bug was.

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