net.java.dev.joode.stepper.lcp
Class BaraffLCP

java.lang.Object
  extended by 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

Field Summary
static BaraffLCP INSTANCE
          the default BaraffLCP-Solver
 
Constructor Summary
BaraffLCP()
          creates a new BaraffLCP.
 
Method Summary
 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
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final BaraffLCP INSTANCE
the default BaraffLCP-Solver

Constructor Detail

BaraffLCP

public BaraffLCP()
creates a new BaraffLCP. It does nothing by now. But later we might want to add some init stuff.

Method Detail

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 constraints
A - the pointer to the matrix containing geometry-information
f - the forces to calculate
b - the initial accelarations
a - the resulting accelaration (after appling the calculated forces)
nub - the number of unbounded contraints (not used yet)
lo - the lower bound
hi - the upper bound
findex - the friction indices (not used yet)

main

public static void main(java.lang.String[] args)