net.java.dev.joode.stepper.lcp
Class BaraffLCP
java.lang.Object
net.java.dev.joode.stepper.lcp.BaraffLCP
public class BaraffLCP
- extends java.lang.Object
Let A be an n x n matrix and b a n Vector in the column space of A.
This Algorithm solves a and f with following conditions:
a = Af+b
a(i) = 0, lo(i) <= f(i) <= hi(i)
or a(i) > 0, lo(i) = f(i)
or a(i) < 0, hi(i) = f(i)
for all 0 <= i < n
This can be illustrated by the following graph.
The point specified by a(i) and f(i) must lie on the line:
w(i)
/|\ | :
| | :
| |i in nc :
| | :
| | :
| | : i in c
w=0 + +-----------------------+
| : |
| : |
w<0 | : |i in nc
| : |
| : |
| : |
+-------|-----------|-----------|----------> x(i)
lo 0 hi
This Algorithm is coded after
Fast Contact Force Computation for Nonpenetrating Rigid Bodies
David Baraff
Robotics Institute Carnegie Mellon University Pittsburgh, PA 15213
But some changes had to be made:
This algorithm has to solve a more general problem than the one presented in the paper.
The two problems would be equivalent, if lo(i) = 0 and hi(i) = +Infinity.
This algorithm should in that case also show the same behavior!
So this algorithm does not only work for contacts, but also for different kinds of joints.
The main method of this algorithm is driveInToRange(int) which is closely related to driveToZero as described in the paper.
It adjusts the force-vector in such kind of a way, that the constraint with the given index also fulfills the conditions.
Constraints, that have been adjusted before are kept in fulfilling their conditions.
So, after having called driveInToRange(int) for all constraints (i to n) we have a solution for the given lcp.
- Author:
- Arne Müller
|
Constructor Summary |
BaraffLCP()
creates a new BaraffLCP. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INSTANCE
public static final BaraffLCP INSTANCE
- the default BaraffLCP-Solver
BaraffLCP
public BaraffLCP()
- creates a new BaraffLCP.
It does nothing by now.
But later we might want to add some init stuff.
computeForces
public void computeForces(int n,
RealPointer A,
RealPointer f,
RealPointer b,
RealPointer a,
int nub,
RealPointer lo,
RealPointer hi,
IntPointer findex)
- computes the forces that need to be applied to satisfy all joint conditions
- Parameters:
n - the number of constraintsA - the pointer to the matrix containing geometry-informationf - the forces to calculateb - the initial accelarationsa - the resulting accelaration (after appling the calculated forces)nub - the number of unbounded contraints (not used yet)lo - the lower boundhi - the upper boundfindex - the friction indices (not used yet)
main
public static void main(java.lang.String[] args)