
Some more complex edge-to-edge collision question
Hi (to johnb or whoever can help out here
)
Assuming that I''ve detected a potential collision between two edges, given as:
x = a + sb
y = c + td
with b and d unit vectors. Furthermore assume that the respective points of collision are p and q .
Then the problem is the collision normal, it is computed as: e = b x d
However, am I guaranteed that the collision goes along e for point p and along -e for q , or could it be the other way around as well? My intuition suggests that it depends on how the edges are defined - but how must the edges be defined to ensure that e is always p ''s collision normal?
For example: If a given edge was from x1 to x2 then surely I could define the edge line as either
x = x1 + k(x2 - x1 )
or
x = x2 + k(x1 - x2 )
but these differences in definition can potentially flip the collision normal.
So how is all of this resolved?
thanks
Henri

I don't think there is an easy way to get the cross product pointing in the right direction every time. Like you said, you can basically flip the cross product be flipping any edge. It's a lot easier (and not time-consuming) to just check afterwards if it must be flipped.
if(Dot(e, p) < 0) e = -e
Be careful about local vs world coordinates here. If p and q are in local space, then e should be transformed into local space as well.
A dot product is just 3 multiplies and 3 adds, so researching other options is hardly justified.
Cédric
[edited by - cedricl on March 31, 2002 10:48:58 AM]
if(Dot(e, p) < 0) e = -e
Be careful about local vs world coordinates here. If p and q are in local space, then e should be transformed into local space as well.
A dot product is just 3 multiplies and 3 adds, so researching other options is hardly justified.
Cédric
[edited by - cedricl on March 31, 2002 10:48:58 AM]
Hi cedricl 
I can see that a dotproduct is a good solution - but I don''t see why Dot(e,p) solves the problem. Geometrically it places p against a plane through the origin with normal e. Perhaps (but I''m not sure) the solution is more like: Dot(e,p-q).
Any ideas?
thanks
Henri

I can see that a dotproduct is a good solution - but I don''t see why Dot(e,p) solves the problem. Geometrically it places p against a plane through the origin with normal e. Perhaps (but I''m not sure) the solution is more like: Dot(e,p-q).
Any ideas?
thanks

Henri
One solution here is to carry additional information with at least one of the edges. A "tracking" point for example that explicitly defines the correct orientation for the cross product. Food for thought.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement