Changeset View
Changeset View
Standalone View
Standalone View
extern/bullet2/src/BulletDynamics/MLCPSolvers/btDantzigLCP.h
| Show All 35 Lines | |||||
| for the special constraints are set: | for the special constraints are set: | ||||
| hi[i] = abs( hi[i] * x[findex[i]] ) | hi[i] = abs( hi[i] * x[findex[i]] ) | ||||
| lo[i] = -hi[i] | lo[i] = -hi[i] | ||||
| and the solution continues. this mechanism allows a friction approximation | and the solution continues. this mechanism allows a friction approximation | ||||
| to be implemented. the first `nub' variables are assumed to have findex < 0. | to be implemented. the first `nub' variables are assumed to have findex < 0. | ||||
| */ | */ | ||||
| #ifndef _BT_LCP_H_ | #ifndef _BT_LCP_H_ | ||||
| #define _BT_LCP_H_ | #define _BT_LCP_H_ | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <assert.h> | #include <assert.h> | ||||
| #include "LinearMath/btScalar.h" | #include "LinearMath/btScalar.h" | ||||
| #include "LinearMath/btAlignedObjectArray.h" | #include "LinearMath/btAlignedObjectArray.h" | ||||
| struct btDantzigScratchMemory | struct btDantzigScratchMemory | ||||
| { | { | ||||
| btAlignedObjectArray<btScalar> m_scratch; | btAlignedObjectArray<btScalar> m_scratch; | ||||
| btAlignedObjectArray<btScalar> L; | btAlignedObjectArray<btScalar> L; | ||||
| btAlignedObjectArray<btScalar> d; | btAlignedObjectArray<btScalar> d; | ||||
| btAlignedObjectArray<btScalar> delta_w; | btAlignedObjectArray<btScalar> delta_w; | ||||
| btAlignedObjectArray<btScalar> delta_x; | btAlignedObjectArray<btScalar> delta_x; | ||||
| btAlignedObjectArray<btScalar> Dell; | btAlignedObjectArray<btScalar> Dell; | ||||
| btAlignedObjectArray<btScalar> ell; | btAlignedObjectArray<btScalar> ell; | ||||
| btAlignedObjectArray<btScalar*> Arows; | btAlignedObjectArray<btScalar *> Arows; | ||||
| btAlignedObjectArray<int> p; | btAlignedObjectArray<int> p; | ||||
| btAlignedObjectArray<int> C; | btAlignedObjectArray<int> C; | ||||
| btAlignedObjectArray<bool> state; | btAlignedObjectArray<bool> state; | ||||
| }; | }; | ||||
| //return false if solving failed | //return false if solving failed | ||||
| bool btSolveDantzigLCP (int n, btScalar *A, btScalar *x, btScalar *b, btScalar *w, | bool btSolveDantzigLCP(int n, btScalar *A, btScalar *x, btScalar *b, btScalar *w, | ||||
| int nub, btScalar *lo, btScalar *hi, int *findex,btDantzigScratchMemory& scratch); | int nub, btScalar *lo, btScalar *hi, int *findex, btDantzigScratchMemory &scratch); | ||||
| #endif //_BT_LCP_H_ | #endif //_BT_LCP_H_ | ||||