Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/physics/src/bullet/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h @ 1963

Last change on this file since 1963 was 1963, checked in by rgrieder, 16 years ago

Added Bullet physics engine.

  • Property svn:eol-style set to native
File size: 3.2 KB
Line 
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 MANIFOLD_CONTACT_POINT_H
17#define MANIFOLD_CONTACT_POINT_H
18
19#include "LinearMath/btVector3.h"
20#include "LinearMath/btTransformUtil.h"
21
22
23
24
25
26/// ManifoldContactPoint collects and maintains persistent contactpoints.
27/// used to improve stability and performance of rigidbody dynamics response.
28class btManifoldPoint
29        {
30                public:
31                        btManifoldPoint()
32                                :m_userPersistentData(0),
33                                m_appliedImpulse(0.f),
34                                m_lateralFrictionInitialized(false),
35                                m_lifeTime(0)
36                        {
37                        }
38
39                        btManifoldPoint( const btVector3 &pointA, const btVector3 &pointB, 
40                                        const btVector3 &normal, 
41                                        btScalar distance ) :
42                                        m_localPointA( pointA ), 
43                                        m_localPointB( pointB ), 
44                                        m_normalWorldOnB( normal ), 
45                                        m_distance1( distance ),
46                                        m_combinedFriction(btScalar(0.)),
47                                        m_combinedRestitution(btScalar(0.)),
48                                        m_userPersistentData(0),
49                                        m_appliedImpulse(0.f),
50                                        m_lateralFrictionInitialized(false),
51                                        m_appliedImpulseLateral1(0.f),
52                                        m_appliedImpulseLateral2(0.f),
53                                        m_lifeTime(0)
54                        {
55                               
56                                       
57                        }
58
59                       
60
61                        btVector3 m_localPointA;                       
62                        btVector3 m_localPointB;                       
63                        btVector3       m_positionWorldOnB;
64                        ///m_positionWorldOnA is redundant information, see getPositionWorldOnA(), but for clarity
65                        btVector3       m_positionWorldOnA;
66                        btVector3 m_normalWorldOnB;
67               
68                        btScalar        m_distance1;
69                        btScalar        m_combinedFriction;
70                        btScalar        m_combinedRestitution;
71
72         //BP mod, store contact triangles.
73         int       m_partId0;
74         int      m_partId1;
75         int      m_index0;
76         int      m_index1;
77                               
78                        mutable void*   m_userPersistentData;
79                        btScalar                m_appliedImpulse;
80
81                        bool                    m_lateralFrictionInitialized;
82                        btScalar                m_appliedImpulseLateral1;
83                        btScalar                m_appliedImpulseLateral2;
84                        int                             m_lifeTime;//lifetime of the contactpoint in frames
85                       
86                        btVector3               m_lateralFrictionDir1;
87                        btVector3               m_lateralFrictionDir2;
88
89                        btScalar getDistance() const
90                        {
91                                return m_distance1;
92                        }
93                        int     getLifeTime() const
94                        {
95                                return m_lifeTime;
96                        }
97
98                        const btVector3& getPositionWorldOnA() const {
99                                return m_positionWorldOnA;
100//                              return m_positionWorldOnB + m_normalWorldOnB * m_distance1;
101                        }
102
103                        const btVector3& getPositionWorldOnB() const
104                        {
105                                return m_positionWorldOnB;
106                        }
107
108                        void    setDistance(btScalar dist)
109                        {
110                                m_distance1 = dist;
111                        }
112                       
113                       
114
115        };
116
117#endif //MANIFOLD_CONTACT_POINT_H
Note: See TracBrowser for help on using the repository browser.