Page 1 of 1

GJK/EPA and hollow shapes

Posted: Mon Apr 14, 2014 11:17 pm
by Numsgil
Is there a way to leverage GJK or EPA for hollow shapes?

Imagine this case:
triangleInsideSquare.png
You want to keep the red triangle inside the black square. In the case in the picture you'd want there to be no collision. But vertex A is *almost* touching the edge, so the distance/separating vector should be pretty small.

EPA would return the separating vector from B to the left edge of the square, which is almost what I want but not quite. I'm guessing there's probably something like a modification of EPA that would give the right answer?

Re: GJK/EPA and hollow shapes

Posted: Thu Apr 17, 2014 6:12 pm
by bone
Wouldn't hollow be the same case as concave? In which case, EPA/GJK aren't really suited to the task.

Re: GJK/EPA and hollow shapes

Posted: Thu Apr 17, 2014 6:32 pm
by Numsgil
It's perhaps similar, but I'd be very surprised if you couldn't get GJK/EPA to work with some modification. I don't think the Minkowski difference is usable, but some sort of erosion CSG type thing might work instead? It should still produce a convex region, which you should still be able to walk with GJK/EPA.