# [ODE] ODE with non-penetration constraint

Nguyen Binh ngbinh at gmail.com
Thu Jul 12 14:40:20 MST 2007

```*note* : maybe there is someone want to follow this discussion so I reply to
the group.

On 7/12/07, Dirk Gregorius <dirk at dirkgregorius.de> wrote:
>
> How can this be?
>
> Think of a pendulum. Your velocity constraint requires that the realtive
> velocity is tangential to the pendulum. Now we satisfy this (velocity)
> constraint. If you integrate now forward using the constraint satisfying
> velocities you will by no means meet the position constraint. You will
> end up outside the circle described by the pendulum
>
> So I assume I misunderstand you. Can you please give an example how you
> find impulses to project on the velocity constraint manifold and then
> after some update of the positions I also atomatically satisfy the
> position constraint?
>
> Here is an example:
> In an impulse solver (equivalent to the ODE) you would solve as follows:
>
> C = |p2 - p1| - L0
> dC/dt = (p2 - p1) / |p2 - p1| * (v2 - v1) -> J = ( -(p2 - p1) / |p2 -
> p1|     (p2 - p1) / |p2 - p1| )
>
> 1) Update velocities
> 2) Apply iteratively sequential impulses until all velocity constraints
> are saisfied
>
> lambda = - J*v / J*W*JT
>
> P1 = -(p2 - p1) / |p2 - p1|  * lambda
> P2 = -P1 = (p2 - p1) / |p2 - p1|  * lambda
>
> v1 += P1 / m1
> v2 += P2 / m2
>
> 3) Update positions using new velocities
>
>
> How would this look in your model?
>

Good catch!
You are right about the fact that it will end up outside the circle. But
that's because we linearized the position constraint. In the pendulum case,
we have C(q) = q^2 - r^2 = 0 but we only enforce it in velocity level.
That's very bad if you use acceleration-force model because the end point
will move away from original circle every time step. With velocity-impulse,
the end point will move in a sets of line that circumscribed the circle,
which is not so bad.

Velocity-Impulse:
+Bilateral constraint:   C(q) = 0

+Taylor series expansion: C(q)[t+1] = C(q)[t] + dC/dq*delta(q) + dq/dt*h =
0;      (1)
h is time step, C(q)[t+1] means the value of C(q) at time t+1.
Note that we only use the linear terms, you can use more but it will make
your system non-linear.

+ Divide by h to have: C(q)[t]/h + J*v[t+1] + delta(q) = 0;    (2)
Here the variable is v[t+1], means we need to find impulses such that v[t+1]
satisfy (2).
If you apply this to the pendulum case, you can see that the end point will
never sway too far from the circle. And if you decided expand Taylor series
in (1) then it will satisfy C(q) exactly.

That's the constraint we need to satisfy. You can see that it's not exactly
the same as your constraint.

All of this method has been discussed quite alot in papers by Jeff Trinkle.
Anitescu, Potra.
--
--------------------------------------------------
Binh Nguyen
Computer Science Department
Rensselaer Polytechnic Institute
Troy, NY, 12180
--------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ode.org/pipermail/ode/attachments/20070712/fcbeff23/attachment.htm
```

More information about the ODE mailing list