Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h @ 8256

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

Reverted trunk again. We might want to find a way to delete these revisions again (x3n's changes are still available as diff in the commit mails).

  • Property svn:eol-style set to native
File size: 2.6 KB
Line 
1#ifndef CONVEX_TRIANGLEMESH_SHAPE_H
2#define CONVEX_TRIANGLEMESH_SHAPE_H
3
4
5#include "btPolyhedralConvexShape.h"
6#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
7
8
9/// The btConvexTriangleMeshShape is a convex hull of a triangle mesh, but the performance is not as good as btConvexHullShape.
10/// A small benefit of this class is that it uses the btStridingMeshInterface, so you can avoid the duplication of the triangle mesh data. Nevertheless, most users should use the much better performing btConvexHullShape instead.
11class btConvexTriangleMeshShape : public btPolyhedralConvexShape
12{
13
14        class btStridingMeshInterface*  m_stridingMesh;
15
16public:
17        btConvexTriangleMeshShape(btStridingMeshInterface* meshInterface, bool calcAabb = true);
18
19        class btStridingMeshInterface*  getMeshInterface()
20        {
21                return m_stridingMesh;
22        }
23        const class btStridingMeshInterface* getMeshInterface() const
24        {
25                return m_stridingMesh;
26        }
27       
28        virtual btVector3       localGetSupportingVertex(const btVector3& vec)const;
29        virtual btVector3       localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
30        virtual void    batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
31       
32        //debugging
33        virtual const char*     getName()const {return "ConvexTrimesh";}
34       
35        virtual int     getNumVertices() const;
36        virtual int getNumEdges() const;
37        virtual void getEdge(int i,btVector3& pa,btVector3& pb) const;
38        virtual void getVertex(int i,btVector3& vtx) const;
39        virtual int     getNumPlanes() const;
40        virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const;
41        virtual bool isInside(const btVector3& pt,btScalar tolerance) const;
42
43       
44        virtual void    setLocalScaling(const btVector3& scaling);
45        virtual const btVector3& getLocalScaling() const;
46
47        ///computes the exact moment of inertia and the transform from the coordinate system defined by the principal axes of the moment of inertia
48        ///and the center of mass to the current coordinate system. A mass of 1 is assumed, for other masses just multiply the computed "inertia"
49        ///by the mass. The resulting transform "principal" has to be applied inversely to the mesh in order for the local coordinate system of the
50        ///shape to be centered at the center of mass and to coincide with the principal axes. This also necessitates a correction of the world transform
51        ///of the collision object by the principal transform. This method also computes the volume of the convex mesh.
52        void calculatePrincipalAxisTransform(btTransform& principal, btVector3& inertia, btScalar& volume) const;
53
54};
55
56
57
58#endif //CONVEX_TRIANGLEMESH_SHAPE_H
59
60
61
Note: See TracBrowser for help on using the repository browser.