Back to index

supertuxkart  0.5+dfsg1
btConvexHullShape.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 CONVEX_HULL_SHAPE_H
00017 #define CONVEX_HULL_SHAPE_H
00018 
00019 #include "btPolyhedralConvexShape.h"
00020 #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
00021 #include "LinearMath/btAlignedObjectArray.h"
00022 
00027 ATTRIBUTE_ALIGNED16(class) btConvexHullShape : public btPolyhedralConvexShape
00028 {
00029        btAlignedObjectArray<btPoint3>     m_points;
00030 
00031 public:
00032        BT_DECLARE_ALIGNED_ALLOCATOR();
00033 
00034        
00038        btConvexHullShape(const btScalar* points=0,int numPoints=0, int stride=sizeof(btPoint3));
00039 
00040        void addPoint(const btPoint3& point);
00041 
00042        btPoint3* getPoints()
00043        {
00044               return &m_points[0];
00045        }
00046 
00047        const btPoint3* getPoints() const
00048        {
00049               return &m_points[0];
00050        }
00051 
00052        int getNumPoints() const 
00053        {
00054               return m_points.size();
00055        }
00056 
00057        virtual btVector3    localGetSupportingVertex(const btVector3& vec)const;
00058        virtual btVector3    localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
00059        virtual void  batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
00060        
00061 
00062        virtual int   getShapeType()const { return CONVEX_HULL_SHAPE_PROXYTYPE; }
00063 
00064        //debugging
00065        virtual const char*  getName()const {return "Convex";}
00066 
00067        
00068        virtual int   getNumVertices() const;
00069        virtual int getNumEdges() const;
00070        virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const;
00071        virtual void getVertex(int i,btPoint3& vtx) const;
00072        virtual int   getNumPlanes() const;
00073        virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const;
00074        virtual       bool isInside(const btPoint3& pt,btScalar tolerance) const;
00075 
00076 
00077 
00078 };
00079 
00080 
00081 #endif //CONVEX_HULL_SHAPE_H
00082