Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/physics/src/bullet/BulletCollision/CollisionShapes/btConvexPointCloudShape.h @ 1963

Last change on this file since 1963 was 1963, checked in by rgrieder, 15 years ago

Added Bullet physics engine.

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef BT_CONVEX_POINT_CLOUD_SHAPE_H
17#define BT_CONVEX_POINT_CLOUD_SHAPE_H
18
19#include "btPolyhedralConvexShape.h"
20#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
21#include "LinearMath/btAlignedObjectArray.h"
22
23///The btConvexPointCloudShape implements an implicit convex hull of an array of vertices.
24ATTRIBUTE_ALIGNED16(class) btConvexPointCloudShape : public btPolyhedralConvexShape
25{
26        btVector3* m_points;
27        int m_numPoints;
28public:
29        BT_DECLARE_ALIGNED_ALLOCATOR();
30
31        btConvexPointCloudShape(btVector3* points,int numPoints, bool computeAabb = true)
32        {
33                m_shapeType = CONVEX_POINT_CLOUD_SHAPE_PROXYTYPE;
34                m_points = points;
35                m_numPoints = numPoints;
36
37                if (computeAabb)
38                        recalcLocalAabb();
39        }
40
41        void setPoints (btVector3* points, int numPoints, bool computeAabb = true)
42        {
43                m_points = points;
44                m_numPoints = numPoints;
45
46                if (computeAabb)
47                        recalcLocalAabb();
48        }
49
50        btPoint3* getPoints()
51        {
52                return m_points;
53        }
54
55        const btPoint3* getPoints() const
56        {
57                return m_points;
58        }
59
60        int getNumPoints() const 
61        {
62                return m_numPoints;
63        }
64
65#ifndef __SPU__
66        virtual btVector3       localGetSupportingVertex(const btVector3& vec)const;
67        virtual btVector3       localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
68        virtual void    batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
69#endif
70
71
72        //debugging
73        virtual const char*     getName()const {return "ConvexPointCloud";}
74
75        virtual int     getNumVertices() const;
76        virtual int getNumEdges() const;
77        virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const;
78        virtual void getVertex(int i,btPoint3& vtx) const;
79        virtual int     getNumPlanes() const;
80        virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const;
81        virtual bool isInside(const btPoint3& pt,btScalar tolerance) const;
82
83        ///in case we receive negative scaling
84        virtual void    setLocalScaling(const btVector3& scaling);
85};
86
87
88#endif //BT_CONVEX_POINT_CLOUD_SHAPE_H
89
Note: See TracBrowser for help on using the repository browser.