Back to index

supertuxkart  0.5+dfsg1
btOdeJoint.h
Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
00004 
00005 This software is provided 'as-is', without any express or implied warranty.
00006 In no event will the authors be held liable for any damages arising from the use of this software.
00007 Permission is granted to anyone to use this software for any purpose, 
00008 including commercial applications, and to alter it and redistribute it freely, 
00009 subject to the following restrictions:
00010 
00011 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00013 3. This notice may not be removed or altered from any source distribution.
00014 */
00015 
00016 #ifndef btOdeJoint_H
00017 #define btOdeJoint_H
00018 
00019 struct btOdeSolverBody;
00020 class btOdeJoint;
00021 
00022 #include "LinearMath/btScalar.h"
00023 
00024 struct BU_ContactJointNode {
00025   btOdeJoint *joint;        // pointer to enclosing btOdeJoint object
00026   btOdeSolverBody* body;                  // *other* body this joint is connected to
00027 };
00028 typedef btScalar dVector3[4];
00029 
00030 
00031 class btOdeJoint  {
00032   
00033 public:
00034        // naming convention: the "first" body this is connected to is node[0].body,
00035   // and the "second" body is node[1].body. if this joint is only connected
00036   // to one body then the second body is 0.
00037 
00038   // info returned by getInfo1 function. the constraint dimension is m (<=6).
00039   // i.e. that is the total number of rows in the jacobian. `nub' is the
00040   // number of unbounded variables (which have lo,hi = -/+ infinity).
00041 
00042   btOdeJoint();
00043   virtual ~btOdeJoint();
00044   
00045 
00046   struct Info1 {
00047     int m,nub;
00048   };
00049 
00050   // info returned by getInfo2 function
00051 
00052   struct Info2 {
00053     // integrator parameters: frames per second (1/stepsize), default error
00054     // reduction parameter (0..1).
00055     btScalar fps,erp;
00056 
00057     // for the first and second body, pointers to two (linear and angular)
00058     // n*3 jacobian sub matrices, stored by rows. these matrices will have
00059     // been initialized to 0 on entry. if the second body is zero then the
00060     // J2xx pointers may be 0.
00061     btScalar *J1l,*J1a,*J2l,*J2a;
00062 
00063     // elements to jump from one row to the next in J's
00064     int rowskip;
00065 
00066     // right hand sides of the equation J*v = c + cfm * lambda. cfm is the
00067     // "constraint force mixing" vector. c is set to zero on entry, cfm is
00068     // set to a constant value (typically very small or zero) value on entry.
00069     btScalar *c,*cfm;
00070 
00071     // lo and hi limits for variables (set to -/+ infinity on entry).
00072     btScalar *lo,*hi;
00073 
00074     // findex vector for variables. see the LCP solver interface for a
00075     // description of what this does. this is set to -1 on entry.
00076     // note that the returned indexes are relative to the first index of
00077     // the constraint.
00078     int *findex;
00079   };
00080 
00081   // virtual function table: size of the joint structure, function pointers.
00082   // we do it this way instead of using C++ virtual functions because
00083   // sometimes we need to allocate joints ourself within a memory pool.
00084 
00085   virtual void GetInfo1 (Info1 *info)=0;
00086   virtual void GetInfo2 (Info2 *info)=0;
00087 
00088   int flags;                // dJOINT_xxx flags
00089   BU_ContactJointNode node[2];            // connections to bodies. node[1].body can be 0
00090    btScalar lambda[6];             // lambda generated by last step
00091 };
00092 
00093 
00094 #endif //btOdeJoint_H