# Tetrahedron vs Sphere (yes, another specific collision detection problem)

This topic is 4911 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I need to check the intersection of a tetrahedron (ie. four point 3d object) and a sphere. It needs to be very fast and I don't think what I've come up with so far is going to cut it: For each face: Get the closest point on the plane. If the sphere is above the plane, return false. If the sphere intersects plane, and the point is within the face, return true. Otherwise, continue. Also record whether the sphere intersects the plane or not, so that if we find that it doesn't intersect any of the planes, we can return true immediately (completely within tetra) Now, I think this is great except for the case where the sphere intersects one of the corners/edges... And I don't want to try getting the distance to all six edges as a final check. Maybe I'll have to... Can anyone think of a better idea? I'd check www.magic-software.com but it doesn't appear to exist anymore :( PS: Know any good alternatives to magic-software? Thanks [Edited by - averisk on August 6, 2005 1:30:07 AM]

##### Share on other sites
http://www.geometrictools.com/

[Edited by - John Schultz on August 6, 2005 2:44:56 AM]

##### Share on other sites
Though it only includes tetrahedron/tetrahedron collision, unfortunately

##### Share on other sites
Check if the sphere is inside all the planes, if true, is intersecting, return.
Find the distance to each triangle, store the nearest distance found (or distance^2), check against sphere center and radius (or radius^2). The Geometric Tools site has a triangle distance example.

A Voronoi region method could also be used (see Wm3DistVector3Frustum3.cpp).

Another triangle-distance method is shown in Real-time Collision Detection.

That will do :)

rating++

##### Share on other sites
Voronoi, GJK, continuous, etc., with source and demos here (register to login to access examples, files. Forum access does not require login).

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 14
• 46
• 22
• 27
• ### Forum Statistics

• Total Topics
634047
• Total Posts
3015226
×