btManifoldPoint.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 MANIFOLD_CONTACT_POINT_H
00017 #define MANIFOLD_CONTACT_POINT_H
00018 
00019 #include "LinearMath/btVector3.h"
00020 #include "LinearMath/btTransformUtil.h"
00021 
00022 
00023 
00024 
00025 
00028 class btManifoldPoint
00029         {
00030                 public:
00031                         btManifoldPoint()
00032                                 :m_userPersistentData(0),
00033                                 m_appliedImpulse(0.f),
00034                                 m_lateralFrictionInitialized(false),
00035                                 m_appliedImpulseLateral1(0.f),
00036                                 m_appliedImpulseLateral2(0.f),
00037                                 m_contactMotion1(0.f),
00038                                 m_contactMotion2(0.f),
00039                                 m_contactCFM1(0.f),
00040                                 m_contactCFM2(0.f),
00041                                 m_lifeTime(0)
00042                         {
00043                         }
00044 
00045                         btManifoldPoint( const btVector3 &pointA, const btVector3 &pointB, 
00046                                         const btVector3 &normal, 
00047                                         btScalar distance ) :
00048                                         m_localPointA( pointA ), 
00049                                         m_localPointB( pointB ), 
00050                                         m_normalWorldOnB( normal ), 
00051                                         m_distance1( distance ),
00052                                         m_combinedFriction(btScalar(0.)),
00053                                         m_combinedRestitution(btScalar(0.)),
00054                                         m_userPersistentData(0),
00055                                         m_appliedImpulse(0.f),
00056                                         m_lateralFrictionInitialized(false),
00057                                         m_appliedImpulseLateral1(0.f),
00058                                         m_appliedImpulseLateral2(0.f),
00059                                         m_contactMotion1(0.f),
00060                                         m_contactMotion2(0.f),
00061                                         m_contactCFM1(0.f),
00062                                         m_contactCFM2(0.f),
00063                                         m_lifeTime(0)
00064                         {
00065                                 
00066                                         
00067                         }
00068 
00069                         
00070 
00071                         btVector3 m_localPointA;                        
00072                         btVector3 m_localPointB;                        
00073                         btVector3       m_positionWorldOnB;
00075                         btVector3       m_positionWorldOnA;
00076                         btVector3 m_normalWorldOnB;
00077                 
00078                         btScalar        m_distance1;
00079                         btScalar        m_combinedFriction;
00080                         btScalar        m_combinedRestitution;
00081 
00082          //BP mod, store contact triangles.
00083          int       m_partId0;
00084          int      m_partId1;
00085          int      m_index0;
00086          int      m_index1;
00087                                 
00088                         mutable void*   m_userPersistentData;
00089                         btScalar                m_appliedImpulse;
00090 
00091                         bool                    m_lateralFrictionInitialized;
00092                         btScalar                m_appliedImpulseLateral1;
00093                         btScalar                m_appliedImpulseLateral2;
00094                         btScalar                m_contactMotion1;
00095                         btScalar                m_contactMotion2;
00096                         btScalar                m_contactCFM1;
00097                         btScalar                m_contactCFM2;
00098 
00099                         int                             m_lifeTime;//lifetime of the contactpoint in frames
00100                         
00101                         btVector3               m_lateralFrictionDir1;
00102                         btVector3               m_lateralFrictionDir2;
00103 
00104                         btScalar getDistance() const
00105                         {
00106                                 return m_distance1;
00107                         }
00108                         int     getLifeTime() const
00109                         {
00110                                 return m_lifeTime;
00111                         }
00112 
00113                         const btVector3& getPositionWorldOnA() const {
00114                                 return m_positionWorldOnA;
00115 //                              return m_positionWorldOnB + m_normalWorldOnB * m_distance1;
00116                         }
00117 
00118                         const btVector3& getPositionWorldOnB() const
00119                         {
00120                                 return m_positionWorldOnB;
00121                         }
00122 
00123                         void    setDistance(btScalar dist)
00124                         {
00125                                 m_distance1 = dist;
00126                         }
00127                         
00129                         btScalar        getAppliedImpulse() const
00130                         {
00131                                 return m_appliedImpulse;
00132                         }
00133 
00134                         
00135 
00136         };
00137 
00138 #endif //MANIFOLD_CONTACT_POINT_H

Generated on Mon Feb 15 22:17:05 2010 for Bullet Collision Detection & Physics Library by  doxygen 1.6.1