Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp')
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp38
1 files changed, 25 insertions, 13 deletions
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
index 5af6e5f03d9..deb3954b5c3 100644
--- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp
@@ -19,7 +19,7 @@ subject to the following restrictions:
-btConvexHullShape ::btConvexHullShape (const float* points,int numPoints,int stride)
+btConvexHullShape ::btConvexHullShape (const btScalar* points,int numPoints,int stride)
{
m_points.resize(numPoints);
@@ -30,26 +30,37 @@ btConvexHullShape ::btConvexHullShape (const float* points,int numPoints,int str
btPoint3* point = (btPoint3*)(pointsBaseAddress + i*stride);
m_points[i] = point[0];
}
+
+ recalcLocalAabb();
+
+}
+
+
+void btConvexHullShape::addPoint(const btPoint3& point)
+{
+ m_points.push_back(point);
+ recalcLocalAabb();
+
}
btVector3 btConvexHullShape::localGetSupportingVertexWithoutMargin(const btVector3& vec0)const
{
- btVector3 supVec(0.f,0.f,0.f);
- btScalar newDot,maxDot = -1e30f;
+ btVector3 supVec(btScalar(0.),btScalar(0.),btScalar(0.));
+ btScalar newDot,maxDot = btScalar(-1e30);
btVector3 vec = vec0;
btScalar lenSqr = vec.length2();
- if (lenSqr < 0.0001f)
+ if (lenSqr < btScalar(0.0001))
{
vec.setValue(1,0,0);
} else
{
- float rlen = 1.f / btSqrt(lenSqr );
+ btScalar rlen = btScalar(1.) / btSqrt(lenSqr );
vec *= rlen;
}
- for (size_t i=0;i<m_points.size();i++)
+ for (int i=0;i<m_points.size();i++)
{
btPoint3 vtx = m_points[i] * m_localScaling;
@@ -70,10 +81,10 @@ void btConvexHullShape::batchedUnitVectorGetSupportingVertexWithoutMargin(const
{
for (int i=0;i<numVectors;i++)
{
- supportVerticesOut[i][3] = -1e30f;
+ supportVerticesOut[i][3] = btScalar(-1e30);
}
}
- for (size_t i=0;i<m_points.size();i++)
+ for (int i=0;i<m_points.size();i++)
{
btPoint3 vtx = m_points[i] * m_localScaling;
@@ -101,12 +112,12 @@ btVector3 btConvexHullShape::localGetSupportingVertex(const btVector3& vec)const
{
btVector3 supVertex = localGetSupportingVertexWithoutMargin(vec);
- if ( getMargin()!=0.f )
+ if ( getMargin()!=btScalar(0.) )
{
btVector3 vecnorm = vec;
if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
{
- vecnorm.setValue(-1.f,-1.f,-1.f);
+ vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
}
vecnorm.normalize();
supVertex+= getMargin() * vecnorm;
@@ -153,13 +164,14 @@ int btConvexHullShape::getNumPlanes() const
return 0;
}
-void btConvexHullShape::getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
+void btConvexHullShape::getPlane(btVector3& ,btPoint3& ,int ) const
{
- assert(0);
+
+ btAssert(0);
}
//not yet
-bool btConvexHullShape::isInside(const btPoint3& pt,btScalar tolerance) const
+bool btConvexHullShape::isInside(const btPoint3& ,btScalar ) const
{
assert(0);
return false;