Back to index

supertuxkart  0.5+dfsg1
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_lifeTime(0)
00035                      {
00036                      }
00037 
00038                      btManifoldPoint( const btVector3 &pointA, const btVector3 &pointB, 
00039                                    const btVector3 &normal, 
00040                                    btScalar distance ) :
00041                                    m_localPointA( pointA ), 
00042                                    m_localPointB( pointB ), 
00043                                    m_normalWorldOnB( normal ), 
00044                                    m_distance1( distance ),
00045                                    m_combinedFriction(btScalar(0.)),
00046                                    m_combinedRestitution(btScalar(0.)),
00047                                    m_userPersistentData(0),
00048                                    m_appliedImpulse(0.f),
00049                                    m_lifeTime(0)
00050                      {
00051                             
00052                                    
00053                      }
00054 
00055                      
00056 
00057                      btVector3 m_localPointA;                  
00058                      btVector3 m_localPointB;                  
00059                      btVector3     m_positionWorldOnB;
00061                      btVector3     m_positionWorldOnA;
00062                      btVector3 m_normalWorldOnB;
00063               
00064                      btScalar      m_distance1;
00065                      btScalar      m_combinedFriction;
00066                      btScalar      m_combinedRestitution;
00067 
00068          //BP mod, store contact triangles.
00069          int     m_partId0;
00070          int      m_partId1;
00071          int      m_index0;
00072          int      m_index1;
00073                             
00074                      mutable void* m_userPersistentData;
00075                      btScalar             m_appliedImpulse;
00076 
00077                      int           m_lifeTime;//lifetime of the contactpoint in frames
00078                      
00079                      btScalar getDistance() const
00080                      {
00081                             return m_distance1;
00082                      }
00083                      int    getLifeTime() const
00084                      {
00085                             return m_lifeTime;
00086                      }
00087 
00088                      const btVector3& getPositionWorldOnA() const {
00089                             return m_positionWorldOnA;
00090 //                          return m_positionWorldOnB + m_normalWorldOnB * m_distance1;
00091                      }
00092 
00093                      const btVector3& getPositionWorldOnB() const
00094                      {
00095                             return m_positionWorldOnB;
00096                      }
00097 
00098                      void   setDistance(btScalar dist)
00099                      {
00100                             m_distance1 = dist;
00101                      }
00102                      
00103                      
00104 
00105        };
00106 
00107 #endif //MANIFOLD_CONTACT_POINT_H