Jump to content

  • Log In with Google      Sign In   
  • Create Account


GJK Simplex Caching and Circles


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
21 replies to this topic

#21 Dirk Gregorius   Members   -  Reputation: 746

Like
1Likes
Like

Posted 26 August 2013 - 03:40 PM

Correct, you get the closest point between the sphere center (or capsule segment) and the polygon/polyhedra and then move the closest point onto the sphere (or capsule) surface.  

 

I think some sample code makes this clearer:

ClosestPointsResult result = FindClosestPoints( pSphere, pPolyhedra );

if ( result.m_flDistance > pSphere->Radius() )
{
   // Shallow penetration - correct for sphere radius and move closest point onto sphere surface
   float flSeparation = result.m_flDistance - pSphere->Radius();
   Vec3 vClosestPointOnSphere = result.m_vPoint1 + pShere->Radius() * Normalize( result.m_vPoint2 - result.m_vPoint1 );
   Vec3 vClosestPointOnPolyhedra = result.m_vPoint2;
}
else
{
    // Deep penetration -> do something else...
}

Edited by Dirk Gregorius, 26 August 2013 - 03:41 PM.


Sponsor:

#22 RastaRunna   Members   -  Reputation: 157

Like
0Likes
Like

Posted 26 August 2013 - 03:48 PM

Very cool, thanks!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS