JuliaGeometry/Meshes.jl

`Box`-`Segment` intersection returns bad result

Opened this issue · 1 comments

I have a box, and a segment, that clearly doesn't intersect, but intersects returns true:

julia> testbox = Box(Point3(-130, -18.78, 46.25), Point3(-110.75, -5.05, 60.0))
Box{3,Float64}
├─ min: Point(-130.0, -18.78, 46.25)
└─ max: Point(-110.75, -5.05, 60.0)

julia> testline = Segment(Point(-70,-50,0), Point(-130, 0, 50))
Segment{3,Float64}
├─ Point(-70.0, -50.0, 0.0)
└─ Point(-130.0, 0.0, 50.0)

julia> intersects(testbox, testline)
true

Using Ray returns false, as expected:

julia> testbox = Box(Point3(-130, -18.78, 46.25), Point3(-110.75, -5.05, 60.0))
Box{3,Float64}
├─ min: Point(-130.0, -18.78, 46.25)
└─ max: Point(-110.75, -5.05, 60.0)

julia> testray = Ray(Point(-70,-50,0), Point(-130, 0, 50)-Point(-70,-50,0))
Ray{3,Float64}
├─ p: Point(-70.0, -50.0, 0.0)
└─ v: Vec(-60.0, 50.0, 50.0)

julia> intersects(testbox, testray)
false

Probably related to #809

cc: @MachSilva