Welcome to mirror list, hosted at ThFree Co, Russian Federation.

BU_Joint.h « Dynamics « BulletDynamics « bullet « extern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 72536d6c2cf8e943c641545d75e16925c31509b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef BU_Joint_H
#define BU_Joint_H

class RigidBody;
class BU_Joint;
#include "SimdScalar.h"

struct BU_ContactJointNode {
  BU_Joint *joint;		// pointer to enclosing BU_Joint object
  RigidBody*body;			// *other* body this joint is connected to
};
typedef SimdScalar dVector3[4];


class BU_Joint  {
  
public:
	// naming convention: the "first" body this is connected to is node[0].body,
  // and the "second" body is node[1].body. if this joint is only connected
  // to one body then the second body is 0.

  // info returned by getInfo1 function. the constraint dimension is m (<=6).
  // i.e. that is the total number of rows in the jacobian. `nub' is the
  // number of unbounded variables (which have lo,hi = -/+ infinity).

  BU_Joint();
  virtual ~BU_Joint();
  

  struct Info1 {
    int m,nub;
  };

  // info returned by getInfo2 function

  struct Info2 {
    // integrator parameters: frames per second (1/stepsize), default error
    // reduction parameter (0..1).
    SimdScalar fps,erp;

    // for the first and second body, pointers to two (linear and angular)
    // n*3 jacobian sub matrices, stored by rows. these matrices will have
    // been initialized to 0 on entry. if the second body is zero then the
    // J2xx pointers may be 0.
    SimdScalar *J1l,*J1a,*J2l,*J2a;

    // elements to jump from one row to the next in J's
    int rowskip;

    // right hand sides of the equation J*v = c + cfm * lambda. cfm is the
    // "constraint force mixing" vector. c is set to zero on entry, cfm is
    // set to a constant value (typically very small or zero) value on entry.
    SimdScalar *c,*cfm;

    // lo and hi limits for variables (set to -/+ infinity on entry).
    SimdScalar *lo,*hi;

    // findex vector for variables. see the LCP solver interface for a
    // description of what this does. this is set to -1 on entry.
    // note that the returned indexes are relative to the first index of
    // the constraint.
    int *findex;
  };

  // virtual function table: size of the joint structure, function pointers.
  // we do it this way instead of using C++ virtual functions because
  // sometimes we need to allocate joints ourself within a memory pool.

  virtual void GetInfo1 (Info1 *info)=0;
  virtual void GetInfo2 (Info2 *info)=0;

  int flags;			// dJOINT_xxx flags
  BU_ContactJointNode node[2];		// connections to bodies. node[1].body can be 0
   SimdScalar lambda[6];		// lambda generated by last step
};


#endif //BU_Joint_H