Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/bullet/BulletDynamics/ConstraintSolver/btContactConstraint.h @ 8001

Last change on this file since 8001 was 5781, checked in by rgrieder, 15 years ago

Reverted trunk again. We might want to find a way to delete these revisions again (x3n's changes are still available as diff in the commit mails).

  • Property svn:eol-style set to native
File size: 4.0 KB
RevLine 
[1963]1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef CONTACT_CONSTRAINT_H
17#define CONTACT_CONSTRAINT_H
18
[2430]19///@todo: make into a proper class working with the iterative constraint solver
[1963]20
21class btRigidBody;
22#include "LinearMath/btVector3.h"
23#include "LinearMath/btScalar.h"
24struct btContactSolverInfo;
25class btManifoldPoint;
26
27enum {
28        DEFAULT_CONTACT_SOLVER_TYPE=0,
29        CONTACT_SOLVER_TYPE1,
30        CONTACT_SOLVER_TYPE2,
31        USER_CONTACT_SOLVER_TYPE1,
32        MAX_CONTACT_SOLVER_TYPES
33};
34
35
36typedef btScalar (*ContactSolverFunc)(btRigidBody& body1,
37                                                                         btRigidBody& body2,
38                                                                         class btManifoldPoint& contactPoint,
39                                                                         const btContactSolverInfo& info);
40
41///stores some extra information to each contact point. It is not in the contact point, because that want to keep the collision detection independent from the constraint solver.
42struct btConstraintPersistentData
43{
44        inline btConstraintPersistentData()
45        :m_appliedImpulse(btScalar(0.)),
46        m_prevAppliedImpulse(btScalar(0.)),
47        m_accumulatedTangentImpulse0(btScalar(0.)),
48        m_accumulatedTangentImpulse1(btScalar(0.)),
49        m_jacDiagABInv(btScalar(0.)),
50        m_persistentLifeTime(0),
51        m_restitution(btScalar(0.)),
52        m_friction(btScalar(0.)),
53        m_penetration(btScalar(0.)),
54        m_contactSolverFunc(0),
55        m_frictionSolverFunc(0)
56        {
57        }
58       
59                                       
60                                /// total applied impulse during most recent frame
61                        btScalar        m_appliedImpulse;
62                        btScalar        m_prevAppliedImpulse;
63                        btScalar        m_accumulatedTangentImpulse0;
64                        btScalar        m_accumulatedTangentImpulse1;
65                       
66                        btScalar        m_jacDiagABInv;
67                        btScalar        m_jacDiagABInvTangent0;
68                        btScalar        m_jacDiagABInvTangent1;
69                        int             m_persistentLifeTime;
70                        btScalar        m_restitution;
71                        btScalar        m_friction;
72                        btScalar        m_penetration;
73                        btVector3       m_frictionWorldTangential0;
74                        btVector3       m_frictionWorldTangential1;
75
76                        btVector3       m_frictionAngularComponent0A;
77                        btVector3       m_frictionAngularComponent0B;
78                        btVector3       m_frictionAngularComponent1A;
79                        btVector3       m_frictionAngularComponent1B;
80
81                        //some data doesn't need to be persistent over frames: todo: clean/reuse this
82                        btVector3       m_angularComponentA;
83                        btVector3       m_angularComponentB;
84               
85                        ContactSolverFunc       m_contactSolverFunc;
86                        ContactSolverFunc       m_frictionSolverFunc;
87
88};
89
90///bilateral constraint between two dynamic objects
91///positive distance = separation, negative distance = penetration
92void resolveSingleBilateral(btRigidBody& body1, const btVector3& pos1,
93                      btRigidBody& body2, const btVector3& pos2,
94                      btScalar distance, const btVector3& normal,btScalar& impulse ,btScalar timeStep);
95
96
97///contact constraint resolution:
98///calculate and apply impulse to satisfy non-penetration and non-negative relative velocity constraint
99///positive distance = separation, negative distance = penetration
100btScalar resolveSingleCollision(
101        btRigidBody& body1,
102        btRigidBody& body2,
103                btManifoldPoint& contactPoint,
104                 const btContactSolverInfo& info);
105
106btScalar resolveSingleFriction(
107        btRigidBody& body1,
108        btRigidBody& body2,
109        btManifoldPoint& contactPoint,
110        const btContactSolverInfo& solverInfo
111                );
112
113
114
115btScalar resolveSingleCollisionCombined(
116        btRigidBody& body1,
117        btRigidBody& body2,
118        btManifoldPoint& contactPoint,
119        const btContactSolverInfo& solverInfo
120                );
121
122#endif //CONTACT_CONSTRAINT_H
Note: See TracBrowser for help on using the repository browser.