Open Dynamics Engine
|
00001 /************************************************************************* 00002 * * 00003 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * 00004 * All rights reserved. Email: russ@q12.org Web: www.q12.org * 00005 * * 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of EITHER: * 00008 * (1) The GNU Lesser General Public License as published by the Free * 00009 * Software Foundation; either version 2.1 of the License, or (at * 00010 * your option) any later version. The text of the GNU Lesser * 00011 * General Public License is included with this library in the * 00012 * file LICENSE.TXT. * 00013 * (2) The BSD-style license that is included with this library in * 00014 * the file LICENSE-BSD.TXT. * 00015 * * 00016 * This library is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * 00019 * LICENSE.TXT and LICENSE-BSD.TXT for more details. * 00020 * * 00021 *************************************************************************/ 00022 00023 /* 00024 00025 given (A,b,lo,hi), solve the LCP problem: A*x = b+w, where each x(i),w(i) 00026 satisfies one of 00027 (1) x = lo, w >= 0 00028 (2) x = hi, w <= 0 00029 (3) lo < x < hi, w = 0 00030 A is a matrix of dimension n*n, everything else is a vector of size n*1. 00031 lo and hi can be +/- dInfinity as needed. the first `nub' variables are 00032 unbounded, i.e. hi and lo are assumed to be +/- dInfinity. 00033 00034 we restrict lo(i) <= 0 and hi(i) >= 0. 00035 00036 the original data (A,b) may be modified by this function. 00037 00038 if the `findex' (friction index) parameter is nonzero, it points to an array 00039 of index values. in this case constraints that have findex[i] >= 0 are 00040 special. all non-special constraints are solved for, then the lo and hi values 00041 for the special constraints are set: 00042 hi[i] = abs( hi[i] * x[findex[i]] ) 00043 lo[i] = -hi[i] 00044 and the solution continues. this mechanism allows a friction approximation 00045 to be implemented. the first `nub' variables are assumed to have findex < 0. 00046 00047 */ 00048 00049 00050 #ifndef _ODE_LCP_H_ 00051 #define _ODE_LCP_H_ 00052 00053 class dxWorldProcessMemArena; 00054 00055 void dSolveLCP (dxWorldProcessMemArena *memarena, 00056 int n, dReal *A, dReal *x, dReal *b, dReal *w, 00057 int nub, dReal *lo, dReal *hi, int *findex); 00058 00059 size_t dEstimateSolveLCPMemoryReq(int n, bool outer_w_avail); 00060 00061 #endif