Changeset View
Changeset View
Standalone View
Standalone View
extern/bullet2/src/BulletCollision/CollisionShapes/btConvexShape.cpp
| /* | /* | ||||
| Bullet Continuous Collision Detection and Physics Library | Bullet Continuous Collision Detection and Physics Library | ||||
| Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org | Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org | ||||
| This software is provided 'as-is', without any express or implied warranty. | This software is provided 'as-is', without any express or implied warranty. | ||||
| In no event will the authors be held liable for any damages arising from the use of this software. | In no event will the authors be held liable for any damages arising from the use of this software. | ||||
| Permission is granted to anyone to use this software for any purpose, | Permission is granted to anyone to use this software for any purpose, | ||||
| including commercial applications, and to alter it and redistribute it freely, | including commercial applications, and to alter it and redistribute it freely, | ||||
| subject to the following restrictions: | subject to the following restrictions: | ||||
| 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. | 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. | ||||
| 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. | ||||
| 3. This notice may not be removed or altered from any source distribution. | 3. This notice may not be removed or altered from any source distribution. | ||||
| */ | */ | ||||
| //#if defined (_WIN32) || defined (__i386__) | #if defined (_WIN32) || defined (__i386__) | ||||
| //#define BT_USE_SSE_IN_API | #define BT_USE_SSE_IN_API | ||||
| //#endif | #endif | ||||
| #include "btConvexShape.h" | #include "btConvexShape.h" | ||||
| #include "btTriangleShape.h" | #include "btTriangleShape.h" | ||||
| #include "btSphereShape.h" | #include "btSphereShape.h" | ||||
| #include "btCylinderShape.h" | #include "btCylinderShape.h" | ||||
| #include "btConeShape.h" | #include "btConeShape.h" | ||||
| #include "btCapsuleShape.h" | #include "btCapsuleShape.h" | ||||
| #include "btConvexHullShape.h" | #include "btConvexHullShape.h" | ||||
| Show All 16 Lines | |||||
| } | } | ||||
| btConvexShape::~btConvexShape() | btConvexShape::~btConvexShape() | ||||
| { | { | ||||
| } | } | ||||
| void btConvexShape::project(const btTransform& trans, const btVector3& dir, btScalar& min, btScalar& max) const | void btConvexShape::project(const btTransform& trans, const btVector3& dir, btScalar& min, btScalar& max, btVector3& witnesPtMin,btVector3& witnesPtMax) const | ||||
| { | { | ||||
| btVector3 localAxis = dir*trans.getBasis(); | btVector3 localAxis = dir*trans.getBasis(); | ||||
| btVector3 vtx1 = trans(localGetSupportingVertex(localAxis)); | btVector3 vtx1 = trans(localGetSupportingVertex(localAxis)); | ||||
| btVector3 vtx2 = trans(localGetSupportingVertex(-localAxis)); | btVector3 vtx2 = trans(localGetSupportingVertex(-localAxis)); | ||||
| min = vtx1.dot(dir); | min = vtx1.dot(dir); | ||||
| max = vtx2.dot(dir); | max = vtx2.dot(dir); | ||||
| witnesPtMax = vtx2; | |||||
| witnesPtMin = vtx1; | |||||
| if(min>max) | if(min>max) | ||||
| { | { | ||||
| btScalar tmp = min; | btScalar tmp = min; | ||||
| min = max; | min = max; | ||||
| max = tmp; | max = tmp; | ||||
| witnesPtMax = vtx1; | |||||
| witnesPtMin = vtx2; | |||||
| } | } | ||||
| } | } | ||||
| static btVector3 convexHullSupport (const btVector3& localDirOrg, const btVector3* points, int numPoints, const btVector3& localScaling) | static btVector3 convexHullSupport (const btVector3& localDirOrg, const btVector3* points, int numPoints, const btVector3& localScaling) | ||||
| { | { | ||||
| btVector3 vec = localDirOrg * localScaling; | btVector3 vec = localDirOrg * localScaling; | ||||
| ▲ Show 20 Lines • Show All 383 Lines • Show Last 20 Lines | |||||