# Re[1]: [ODE] Negative penetration depths

Raul Aguaviva raul.aguaviva at powervr.com
Thu Sep 5 08:20:02 2002

```ok, lets say we have two objects intersecting, and the | obejrct is still..
|
-----|---
|

Check the direction of movement of the ----- object and you'll know from
where was that object coming from so you can push it in the opposite
direction.

I hope this helps
Raul

-----Original Message-----
From: Thomas Harte [mailto:thomasharte@lycos.co.uk]
Sent: 04 September 2002 20:14
To:
Subject: Re[1]: [ODE] Negative penetration depths

Nate W :
> What are you trying to achieve with negative penetration? Are you trying
> to get rid of an oscillating pentrate/no-penetrate problem?

I'm performing mesh on mesh collisions. But in my world polygons may be two
faced, or
if you prefer to think of it that way, my objects may be infinitely thin.
They also are not
necessarily convex. Therefore I start getting into trouble if a vertex
'breaks through' one
of these infinitely thin polygons, because it is not obvious which side of
the polygon it
should be on. In particular, consider that it may start on the 'wrong' side
of the polygon
as a result of the contact constraint not having fully fixed the problem
from a moment
ago, and that it may interact with many polygons at once, so using a state
based design
could become very memory expensive.

Therefore, in my solution, when an object is found to intersect another, a
binary search
(see the other thread on stepping backwards in time / restoring an old
state) is done
through the step time to find a point before it intersected, but when it was
'very close'.
The constraint is added then to definitely keep the vertex on the correct
side of the
polygon and future problems are avoided at root.

The secondary advantage of this solution is that I explicitly trade off
maximum
penetration against processing time, rather than indirectly by means of
picking a time
step length. Unfortunately it does not solve the problem of tunnelling, but
that one I have
been able to avoid by starting with a relatively low time step.

Naturally, I know that mesh on mesh collisions involves checking edges
against edges
also, which is handled in a similar way.

Martin C. Martin :
> My understanding doesn't involve a differential equation. Basically,
> there are two parts to a constraint. One says "the velocity of this point
> on the object needs to be at least this much in this direction."

Obviously the non-contact constraints are differential equations, since most
of them
explicitly define allowed forces as a function of position. ODE gives the
game away on
that front in any case by explicitly having a small section on Integration -
section 3.3.

Now to explain the confusion - my understanding, gained principly from those

Siggraph '97 papers that seem to be some sort of definitive source for
computer people,
is that a contact constraint says :

"this point must not travel beyond this planar distance"

This time making velocity a function of position, and again yielding a
differential equation.

> And
> the penalty method the way you've described it -- apply a greater force
> the more the constraint is violated -- doesn't require a solver and
> doesn't work very well.

No, but then the fact that it doesn't need a solver reveals nothing, when we
decided that a solver is needed regarless of the existance or not of a
penalty method in
addition to the real hard constraints, and the fact that it doesn't work
very well isn't
relevant. The hard constraint means that the problem of interpenetration
can't get any
worse, and the soft one (i.e. the penalty method) makes the problem get a
little better.
So the two combined make a better solution than either individually.

But I will try your box example, since it does seem to disprove this theory.

> > In the case of negative penetration depth, it is my fear that ODE may
still try to
impose
> > the penalty method, but in using a negative distance, will pull the
objects together
rather
> > than letting them move correctly.
>
> This would be very easy to test...

Yes. It was! And the result is that adding a contact constraint with a
negative penetration
depth does cause the two objects to be sucked together, making me think that

regardless of how hard the hard constraint actually is, the penalty method
is in there
somewhere.

-Thomas

P.s. apologies if this message appears twice, when my web mail times out it
never
reveals where it timed out in terms of the process of sending the mail then