2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
11 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.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
16 #include "btTetrahedronShape.h"
17 #include "LinearMath/btMatrix3x3.h"
19 btBU_Simplex1to4::btBU_Simplex1to4() : btPolyhedralConvexAabbCachingShape(),
22 m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
25 btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0) : btPolyhedralConvexAabbCachingShape(),
28 m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
32 btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0, const btVector3& pt1) : btPolyhedralConvexAabbCachingShape(),
35 m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
40 btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0, const btVector3& pt1, const btVector3& pt2) : btPolyhedralConvexAabbCachingShape(),
43 m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
49 btBU_Simplex1to4::btBU_Simplex1to4(const btVector3& pt0, const btVector3& pt1, const btVector3& pt2, const btVector3& pt3) : btPolyhedralConvexAabbCachingShape(),
52 m_shapeType = TETRAHEDRAL_SHAPE_PROXYTYPE;
59 void btBU_Simplex1to4::getAabb(const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const
62 btPolyhedralConvexAabbCachingShape::getAabb(t, aabbMin, aabbMax);
64 aabbMin.setValue(BT_LARGE_FLOAT, BT_LARGE_FLOAT, BT_LARGE_FLOAT);
65 aabbMax.setValue(-BT_LARGE_FLOAT, -BT_LARGE_FLOAT, -BT_LARGE_FLOAT);
67 //just transform the vertices in worldspace, and take their AABB
68 for (int i = 0; i < m_numVertices; i++)
70 btVector3 worldVertex = t(m_vertices[i]);
71 aabbMin.setMin(worldVertex);
72 aabbMax.setMax(worldVertex);
77 void btBU_Simplex1to4::addVertex(const btVector3& pt)
79 m_vertices[m_numVertices++] = pt;
83 int btBU_Simplex1to4::getNumVertices() const
88 int btBU_Simplex1to4::getNumEdges() const
90 //euler formula, F-E+V = 2, so E = F+V-2
92 switch (m_numVertices)
109 void btBU_Simplex1to4::getEdge(int i, btVector3& pa, btVector3& pb) const
111 switch (m_numVertices)
165 void btBU_Simplex1to4::getVertex(int i, btVector3& vtx) const
170 int btBU_Simplex1to4::getNumPlanes() const
172 switch (m_numVertices)
191 void btBU_Simplex1to4::getPlane(btVector3&, btVector3&, int) const
195 int btBU_Simplex1to4::getIndex(int) const
200 bool btBU_Simplex1to4::isInside(const btVector3&, btScalar) const