btDiscreteCollisionDetectorInterface.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 
00017 #ifndef BT_DISCRETE_COLLISION_DETECTOR1_INTERFACE_H
00018 #define BT_DISCRETE_COLLISION_DETECTOR1_INTERFACE_H
00019 
00020 #include "LinearMath/btTransform.h"
00021 #include "LinearMath/btVector3.h"
00022 class btStackAlloc;
00023 
00029 struct btDiscreteCollisionDetectorInterface
00030 {
00031         
00032         struct Result
00033         {
00034         
00035                 virtual ~Result(){}     
00036 
00038                 virtual void setShapeIdentifiersA(int partId0,int index0)=0;
00039                 virtual void setShapeIdentifiersB(int partId1,int index1)=0;
00040                 virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth)=0;
00041         };
00042 
00043         struct ClosestPointInput
00044         {
00045                 ClosestPointInput()
00046                         :m_maximumDistanceSquared(btScalar(BT_LARGE_FLOAT)),
00047                         m_stackAlloc(0)
00048                 {
00049                 }
00050 
00051                 btTransform m_transformA;
00052                 btTransform m_transformB;
00053                 btScalar        m_maximumDistanceSquared;
00054                 btStackAlloc* m_stackAlloc;
00055         };
00056 
00057         virtual ~btDiscreteCollisionDetectorInterface() {};
00058 
00059         //
00060         // give either closest points (distance > 0) or penetration (distance)
00061         // the normal always points from B towards A
00062         //
00063         virtual void    getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults=false) = 0;
00064 
00065 };
00066 
00067 struct btStorageResult : public btDiscreteCollisionDetectorInterface::Result
00068 {
00069                 btVector3       m_normalOnSurfaceB;
00070                 btVector3       m_closestPointInB;
00071                 btScalar        m_distance; //negative means penetration !
00072 
00073                 btStorageResult() : m_distance(btScalar(BT_LARGE_FLOAT))
00074                 {
00075 
00076                 }
00077                 virtual ~btStorageResult() {};
00078 
00079                 virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth)
00080                 {
00081                         if (depth < m_distance)
00082                         {
00083                                 m_normalOnSurfaceB = normalOnBInWorld;
00084                                 m_closestPointInB = pointInWorld;
00085                                 m_distance = depth;
00086                         }
00087                 }
00088 };
00089 
00090 #endif //BT_DISCRETE_COLLISION_DETECTOR1_INTERFACE_H
00091 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


bullet
Author(s): Erwin Coumans, ROS package maintained by Tully Foote
autogenerated on Wed Oct 31 2012 07:54:31