Polyhedrons closest features.

Polyhedron
Posts: 2
Joined: Wed Feb 15, 2006 10:00 pm

Polyhedrons closest features.

Post by Polyhedron »

Hello,
First of all, i'd like to say that this is an extraordinary site.Thanks for making it.
I'm makeing a simple physics library as a hobby project.
So far it supports convex bodies and a binch of static planes that make the static geometry, but i need to move to convex body <> convex body iteraction and need to figure the closest features between the polyhedras.
Can i use your library to just find the closest points ?
Is there some usefull routines that i can use, or the narrow phase is competely integrated into your code, and can't be used separated that easy ? Basicaly i need to send my faces of the convex bodies to the routine, and get the two colsest points/features.
I'm sorry if my question is irrelevant, but i just thought there might be an easier way instead of hacking your code, to get the GJK out of it.

Thanks in advance.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

You can use the Bullet library to just get the closest points between two shapes. There is a demo in Bullet physics engine called 'ConvexHullDistanceDemo.cpp' that shows how to do it.

You can view it quickly here in the Blender sourcetree, because Bullet is part of that too: http://projects.blender.org/viewcvs/vie ... cvs-markup

This gives you only 1 point. Usually physics simulation works better if you got multiple point. For that Bullet has an extra PersistentManifold class. You can feed the points in there, and call the appropriate methods to update. However some people pointed out that a more friendly interface would be recommended. I'll add this soon.

By the way, you can download Bullet here: http://www.continuousphysics.com/Bullet
Polyhedron
Posts: 2
Joined: Wed Feb 15, 2006 10:00 pm

Post by Polyhedron »

Thanks, i'll have a look at this demo.