Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "btSphereShape.h"
00017 #include "BulletCollision/CollisionShapes/btCollisionMargin.h"
00018
00019 #include "LinearMath/btQuaternion.h"
00020
00021 btVector3 btSphereShape::localGetSupportingVertexWithoutMargin(const btVector3& vec)const
00022 {
00023 (void)vec;
00024 return btVector3(btScalar(0.),btScalar(0.),btScalar(0.));
00025 }
00026
00027 void btSphereShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const
00028 {
00029 (void)vectors;
00030
00031 for (int i=0;i<numVectors;i++)
00032 {
00033 supportVerticesOut[i].setValue(btScalar(0.),btScalar(0.),btScalar(0.));
00034 }
00035 }
00036
00037
00038 btVector3 btSphereShape::localGetSupportingVertex(const btVector3& vec)const
00039 {
00040 btVector3 supVertex;
00041 supVertex = localGetSupportingVertexWithoutMargin(vec);
00042
00043 btVector3 vecnorm = vec;
00044 if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
00045 {
00046 vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
00047 }
00048 vecnorm.normalize();
00049 supVertex+= getMargin() * vecnorm;
00050 return supVertex;
00051 }
00052
00053
00054
00055 void btSphereShape::getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const
00056 {
00057 const btVector3& center = t.getOrigin();
00058 btVector3 extent(getMargin(),getMargin(),getMargin());
00059 aabbMin = center - extent;
00060 aabbMax = center + extent;
00061 }
00062
00063
00064
00065 void btSphereShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const
00066 {
00067 btScalar elem = btScalar(0.4) * mass * getMargin()*getMargin();
00068 inertia.setValue(elem,elem,elem);
00069
00070 }
00071