btConvexHullShape.h
Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
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 BT_CONVEX_HULL_SHAPE_H
00017 #define BT_CONVEX_HULL_SHAPE_H
00018 
00019 #include "btPolyhedralConvexShape.h"
00020 #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
00021 #include "LinearMath/btAlignedObjectArray.h"
00022 
00023 
00026 ATTRIBUTE_ALIGNED16(class) btConvexHullShape : public btPolyhedralConvexAabbCachingShape
00027 {
00028         btAlignedObjectArray<btVector3> m_unscaledPoints;
00029 
00030 public:
00031         BT_DECLARE_ALIGNED_ALLOCATOR();
00032 
00033         
00037         btConvexHullShape(const btScalar* points=0,int numPoints=0, int stride=sizeof(btVector3));
00038 
00039         void addPoint(const btVector3& point);
00040 
00041         
00042         btVector3* getUnscaledPoints()
00043         {
00044                 return &m_unscaledPoints[0];
00045         }
00046 
00047         const btVector3* getUnscaledPoints() const
00048         {
00049                 return &m_unscaledPoints[0];
00050         }
00051 
00053         const btVector3* getPoints() const
00054         {
00055                 return getUnscaledPoints();
00056         }
00057 
00058         
00059 
00060 
00061         SIMD_FORCE_INLINE       btVector3 getScaledPoint(int i) const
00062         {
00063                 return m_unscaledPoints[i] * m_localScaling;
00064         }
00065 
00066         SIMD_FORCE_INLINE       int getNumPoints() const 
00067         {
00068                 return m_unscaledPoints.size();
00069         }
00070 
00071         virtual btVector3       localGetSupportingVertex(const btVector3& vec)const;
00072         virtual btVector3       localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
00073         virtual void    batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
00074         
00075 
00076         virtual void project(const btTransform& trans, const btVector3& dir, float& min, float& max) const;
00077 
00078 
00079         //debugging
00080         virtual const char*     getName()const {return "Convex";}
00081 
00082         
00083         virtual int     getNumVertices() const;
00084         virtual int getNumEdges() const;
00085         virtual void getEdge(int i,btVector3& pa,btVector3& pb) const;
00086         virtual void getVertex(int i,btVector3& vtx) const;
00087         virtual int     getNumPlanes() const;
00088         virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const;
00089         virtual bool isInside(const btVector3& pt,btScalar tolerance) const;
00090 
00092         virtual void    setLocalScaling(const btVector3& scaling);
00093 
00094         virtual int     calculateSerializeBufferSize() const;
00095 
00097         virtual const char*     serialize(void* dataBuffer, btSerializer* serializer) const;
00098 
00099 };
00100 
00102 struct  btConvexHullShapeData
00103 {
00104         btConvexInternalShapeData       m_convexInternalShapeData;
00105 
00106         btVector3FloatData      *m_unscaledPointsFloatPtr;
00107         btVector3DoubleData     *m_unscaledPointsDoublePtr;
00108 
00109         int             m_numUnscaledPoints;
00110         char m_padding3[4];
00111 
00112 };
00113 
00114 
00115 SIMD_FORCE_INLINE       int     btConvexHullShape::calculateSerializeBufferSize() const
00116 {
00117         return sizeof(btConvexHullShapeData);
00118 }
00119 
00120 
00121 #endif //BT_CONVEX_HULL_SHAPE_H
00122 
 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