diff options
author | sanine <sanine.not@pm.me> | 2022-10-01 20:59:36 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-10-01 20:59:36 -0500 |
commit | c5fc66ee58f2c60f2d226868bb1cf5b91badaf53 (patch) | |
tree | 277dd280daf10bf77013236b8edfa5f88708c7e0 /libs/ode-0.16.1/ode/src/lcp.h | |
parent | 1cf9cc3408af7008451f9133fb95af66a9697d15 (diff) |
add ode
Diffstat (limited to 'libs/ode-0.16.1/ode/src/lcp.h')
-rw-r--r-- | libs/ode-0.16.1/ode/src/lcp.h | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/libs/ode-0.16.1/ode/src/lcp.h b/libs/ode-0.16.1/ode/src/lcp.h new file mode 100644 index 0000000..da65d6f --- /dev/null +++ b/libs/ode-0.16.1/ode/src/lcp.h @@ -0,0 +1,81 @@ +/************************************************************************* + * * + * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. * + * All rights reserved. Email: russ@q12.org Web: www.q12.org * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of EITHER: * + * (1) The GNU Lesser General Public License as published by the Free * + * Software Foundation; either version 2.1 of the License, or (at * + * your option) any later version. The text of the GNU Lesser * + * General Public License is included with this library in the * + * file LICENSE.TXT. * + * (2) The BSD-style license that is included with this library in * + * the file LICENSE-BSD.TXT. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files * + * LICENSE.TXT and LICENSE-BSD.TXT for more details. * + * * + *************************************************************************/ + +/* + +given (A,b,lo,hi), solve the LCP problem: A*x = b+w, where each x(i),w(i) +satisfies one of + (1) x = lo, w >= 0 + (2) x = hi, w <= 0 + (3) lo < x < hi, w = 0 +A is a matrix of dimension n*n, everything else is a vector of size n*1. +lo and hi can be +/- dInfinity as needed. the first `nub' variables are +unbounded, i.e. hi and lo are assumed to be +/- dInfinity. + +we restrict lo(i) <= 0 and hi(i) >= 0. + +the original data (A,b) may be modified by this function. + +if the `findex' (friction index) parameter is nonzero, it points to an array +of index values. in this case constraints that have findex[i] >= 0 are +special. all non-special constraints are solved for, then the lo and hi values +for the special constraints are set: + hi[i] = abs( hi[i] * x[findex[i]] ) + lo[i] = -hi[i] +and the solution continues. this mechanism allows a friction approximation +to be implemented. the first `nub' variables are assumed to have findex < 0. + +*/ + + +#ifndef _ODE_LCP_H_ +#define _ODE_LCP_H_ + +class dxWorldProcessMemArena; + +enum dxLCPBXElement +{ + PBX__MIN, + + PBX_B = PBX__MIN, + PBX_X, + + PBX__MAX, +}; + +enum dxLCPLHElement +{ + PLH__MIN, + + PLH_LO = PLH__MIN, + PLH_HI, + + PLH__MAX, +}; + +void dxSolveLCP (dxWorldProcessMemArena *memarena, + unsigned n, dReal *A, dReal pairsbx[PBX__MAX], dReal *w, + unsigned nub, dReal pairslh[PLH__MAX], int *findex); + +sizeint dxEstimateSolveLCPMemoryReq(unsigned n, bool outer_w_avail); + +#endif |