Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualchandlerp

Posted 04 November 2012 - 03:45 PM

I'm trying to implement the GJK algorithm but am having difficulty calculating the support points. For my test case I am using equally size boxes stacked on top of each other, with box 2 at the origin and box 1 translated 10 units on the Y axis.

 ____
| 1  |
|____|
| 2  |
|____|

I start with a search direction of ( 0, 1 ) which finds the support points:
Box 1 - ( 5, 15 )
Box 2 - ( 5, -5 )

This yields the GJK support point of ( 5, 15 ) - ( 5, -5 ) == ( 0, 20 ). The Y term is correct but the X term is obviously wrong; the correct point on the Minkowski difference is ( 20, 20 ). This is found if Box 2's vertex at ( -5, -5 ) is used, but because both ( 5, -5 ) and ( -5, -5 ) meet the max( -DtBj ) requirement it depends which vertex was added to the hull first.

Question is how to guarantee the correct vertex is found to calculate the difference? Bonus points for a solution which works in 3 dimensions as that is the world the algorithm lives in.

#1chandlerp

Posted 04 November 2012 - 03:44 PM

I'm trying to implement the GJK algorithm but am having difficulty calculating the support points. For my test case I am using equally size boxes stacked on top of each other, with box 2 at the origin and box 1 translated 10 units on the Y axis.

____
| 1  |
|____|
| 2  |
|____|

I start with a search direction of ( 0, 1 ) which finds the support points:
Box 1 - ( 5, 15 )
Box 2 - ( 5, -5 )

This yields the GJK support point of ( 5, 15 ) - ( 5, -5 ) == ( 0, 20 ). The Y term is correct but the X term is obviously wrong; the correct point on the Minkowski difference is ( 20, 20 ). This is found if Box 2's vertex at ( -5, -5 ) is used, but because both ( 5, -5 ) and ( -5, -5 ) meet the max( -DtBj ) requirement it depends which vertex was added to the hull first.

Question is how to guarantee the correct vertex is found to calculate the difference? Bonus points for a solution which works in 3 dimensions as that is the world the algorithm lives in.

PARTNERS