Bullet Collision Detection & Physics Library
Main Page
Namespaces
Classes
Files
File List
File Members
src
BulletDynamics
MLCPSolvers
btDantzigLCP.h
Go to the documentation of this file.
1
/*************************************************************************
2
* *
3
* Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
5
* *
6
* This library is free software; you can redistribute it and/or *
7
* modify it under the terms of *
8
* The BSD-style license that is included with this library in *
9
* the file LICENSE-BSD.TXT. *
10
* *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
14
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
15
* *
16
*************************************************************************/
17
18
/*
19
20
given (A,b,lo,hi), solve the LCP problem: A*x = b+w, where each x(i),w(i)
21
satisfies one of
22
(1) x = lo, w >= 0
23
(2) x = hi, w <= 0
24
(3) lo < x < hi, w = 0
25
A is a matrix of dimension n*n, everything else is a vector of size n*1.
26
lo and hi can be +/- dInfinity as needed. the first `nub' variables are
27
unbounded, i.e. hi and lo are assumed to be +/- dInfinity.
28
29
we restrict lo(i) <= 0 and hi(i) >= 0.
30
31
the original data (A,b) may be modified by this function.
32
33
if the `findex' (friction index) parameter is nonzero, it points to an array
34
of index values. in this case constraints that have findex[i] >= 0 are
35
special. all non-special constraints are solved for, then the lo and hi values
36
for the special constraints are set:
37
hi[i] = abs( hi[i] * x[findex[i]] )
38
lo[i] = -hi[i]
39
and the solution continues. this mechanism allows a friction approximation
40
to be implemented. the first `nub' variables are assumed to have findex < 0.
41
42
*/
43
44
45
#ifndef _BT_LCP_H_
46
#define _BT_LCP_H_
47
48
#include <stdlib.h>
49
#include <stdio.h>
50
#include <assert.h>
51
52
53
#include "
LinearMath/btScalar.h
"
54
#include "
LinearMath/btAlignedObjectArray.h
"
55
56
struct
btDantzigScratchMemory
57
{
58
btAlignedObjectArray<btScalar>
m_scratch
;
59
btAlignedObjectArray<btScalar>
L
;
60
btAlignedObjectArray<btScalar>
d
;
61
btAlignedObjectArray<btScalar>
delta_w
;
62
btAlignedObjectArray<btScalar>
delta_x
;
63
btAlignedObjectArray<btScalar>
Dell
;
64
btAlignedObjectArray<btScalar>
ell
;
65
btAlignedObjectArray<btScalar*>
Arows
;
66
btAlignedObjectArray<int>
p
;
67
btAlignedObjectArray<int>
C
;
68
btAlignedObjectArray<bool>
state
;
69
};
70
71
//return false if solving failed
72
bool
btSolveDantzigLCP
(
int
n,
btScalar
*A,
btScalar
*x,
btScalar
*b,
btScalar
*w,
73
int
nub,
btScalar
*lo,
btScalar
*hi,
int
*findex,
btDantzigScratchMemory
& scratch);
74
75
76
77
#endif //_BT_LCP_H_
btAlignedObjectArray< btScalar >
btDantzigScratchMemory::Arows
btAlignedObjectArray< btScalar * > Arows
Definition:
btDantzigLCP.h:65
btDantzigScratchMemory::delta_w
btAlignedObjectArray< btScalar > delta_w
Definition:
btDantzigLCP.h:61
btSolveDantzigLCP
bool btSolveDantzigLCP(int n, btScalar *A, btScalar *x, btScalar *b, btScalar *w, int nub, btScalar *lo, btScalar *hi, int *findex, btDantzigScratchMemory &scratch)
Definition:
btDantzigLCP.cpp:1780
btDantzigScratchMemory
Definition:
btDantzigLCP.h:56
btDantzigScratchMemory::m_scratch
btAlignedObjectArray< btScalar > m_scratch
Definition:
btDantzigLCP.h:58
btDantzigScratchMemory::Dell
btAlignedObjectArray< btScalar > Dell
Definition:
btDantzigLCP.h:63
btDantzigScratchMemory::p
btAlignedObjectArray< int > p
Definition:
btDantzigLCP.h:66
btDantzigScratchMemory::C
btAlignedObjectArray< int > C
Definition:
btDantzigLCP.h:67
btDantzigScratchMemory::ell
btAlignedObjectArray< btScalar > ell
Definition:
btDantzigLCP.h:64
btDantzigScratchMemory::delta_x
btAlignedObjectArray< btScalar > delta_x
Definition:
btDantzigLCP.h:62
btAlignedObjectArray.h
btDantzigScratchMemory::L
btAlignedObjectArray< btScalar > L
Definition:
btDantzigLCP.h:59
btDantzigScratchMemory::d
btAlignedObjectArray< btScalar > d
Definition:
btDantzigLCP.h:60
btDantzigScratchMemory::state
btAlignedObjectArray< bool > state
Definition:
btDantzigLCP.h:68
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition:
btScalar.h:266
btScalar.h
Generated on Wed Feb 5 2014 21:36:50 for Bullet Collision Detection & Physics Library by
1.8.6