poly-poly collision detection

Started by
9 comments, last by glSmurf 18 years, 11 months ago
I need a fast method of finding an intersection point and normal between two polyhedras. Do I solve this by dividing each polygon into triangles or is there a better way? There is also an issue of finding the collision normal as the polys can collide in different ways ( face-face, edge-face, vertex-face, vertex-vertex and so on )
Advertisement
Take a look at this:
http://www.geometrictools.com/

There you can find a lot of different algorithm for collision detection.

Best regards
Kimmi
A complicate solution may indicate a not understood problem.


[twitter]KimKulling[/twitter]
couldn't find anything about poly-poly collision there, lots of good code though.
3D or 2D

Everything is better with Metal.

Hm, you can try this paper from the hp:
http://www.geometrictools.com/Documentation/MethodOfSeparatingAxes.pdf

Best regards kimmi
A complicate solution may indicate a not understood problem.


[twitter]KimKulling[/twitter]
Quote:Original post by oliii
3D or 2D


3D

I do know how to get the intersection point, but I want to know if there are faster ways to do it.
For now I divide polys into triangles, but I think it would be alot faster if I found a way to only do one collision check againts the whole poly.

Now computing the collision normal is my biggest problem. For example if there is a vertex-vertex collision, what is the collision normal of that? same for edge-edge.

edge edge is simply the cross product of the two edges.

vertex-vertex would be the line passing through both vertices.

Everything is better with Metal.

tnx oliii

how about vertex-edge collision then?
Store each objects geometry in a tree, and then compare the trees against each other this can dramatically reduce the number of compares you perform.
Quote:Original post by glSmurf
tnx oliii

how about vertex-edge collision then?


line passing through projection of the point onto the edge towards the vertex.

Vector V; // vertex
Vector E0, E1; // edge
Vector W; // result (which is also closest point on the edge towards the vertex).

Vector D = V - E0;
Vector E = E1 - E0;
float ed = D.DotProduct(E);
float e2 = E.DotProduct(E);
float t = ed / e2;
t = (t < 0.0f)? 0.0f : (t > 1.0f)? 1.0f : t;

W = E0 + t * E;


-> Normal of collision

Ncoll = (W - V).Direction();

Everything is better with Metal.

This topic is closed to new replies.

Advertisement