Skip to content

Box-Triangle intersection in 3D #809

Open
@cserteGT3

Description

@cserteGT3

I discovered the following:

t = Triangle((Point(-60.0, -35.0, 55.0), Point(-68.75, -33.43333, 54.90143), Point(-68.75, -35.0, 55.0)))
b = Box((-77.5, -35.0, 54.6073),(-68.75, -31.8914, 55.0))
intersects(b, t)

Running this code causes an infinite loop here:

while true
P = minkowskipoint(g₁, g₂, d)
if (P - O) d < zero(T)
return false
end
push!(points, P)
d = gjk!(O, points)
isnothing(d) && return true

In this particular case changing the argument order solves the issue (running intersects(t,b)), but in general it does not solve the issue.
I tried normalizing my input, but it doesn't help.

s = maximum(sides(boundingbox([t, b])))
tn = Scale(1 / s)(t)
bn = Scale(1 / s)(b)
intersects(bn, tn)

I am not sure why is this the case, on other triangle-box pairs it works fine. Maybe because they have one vertice that is common?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions