00001 /* 00002 Bullet Continuous Collision Detection and Physics Library 00003 Copyright (c) 2011 Advanced Micro Devices, Inc. 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 00018 00019 00020 #ifndef _BT_POLYHEDRAL_FEATURES_H 00021 #define _BT_POLYHEDRAL_FEATURES_H 00022 00023 #include "LinearMath/btTransform.h" 00024 #include "LinearMath/btAlignedObjectArray.h" 00025 00026 #define TEST_INTERNAL_OBJECTS 1 00027 00028 00029 struct btFace 00030 { 00031 btAlignedObjectArray<int> m_indices; 00032 // btAlignedObjectArray<int> m_connectedFaces; 00033 btScalar m_plane[4]; 00034 }; 00035 00036 00037 ATTRIBUTE_ALIGNED16(class) btConvexPolyhedron 00038 { 00039 public: 00040 00041 BT_DECLARE_ALIGNED_ALLOCATOR(); 00042 00043 btConvexPolyhedron(); 00044 virtual ~btConvexPolyhedron(); 00045 00046 btAlignedObjectArray<btVector3> m_vertices; 00047 btAlignedObjectArray<btFace> m_faces; 00048 btAlignedObjectArray<btVector3> m_uniqueEdges; 00049 00050 btVector3 m_localCenter; 00051 btVector3 m_extents; 00052 btScalar m_radius; 00053 btVector3 mC; 00054 btVector3 mE; 00055 00056 void initialize(); 00057 bool testContainment() const; 00058 00059 void project(const btTransform& trans, const btVector3& dir, btScalar& minProj, btScalar& maxProj, btVector3& witnesPtMin,btVector3& witnesPtMax) const; 00060 }; 00061 00062 00063 #endif //_BT_POLYHEDRAL_FEATURES_H 00064 00065