Added Pierre Terdiman's 'internal object' optimization to improve performance for separating axis tests.
Make the winding consistent in btConvexHullComputer (and related fixes in btPolyhedralConvexShape), thanks to Ole! Some fixes in the btPolyhedralContactClipping implementation (never report a penetration deeper than GJK/EPA found, to avoid issues due to its approximate contact normal directions) Properly visualize btPolyhedralConvexHullShape that have a btConvexPolyhedron (by calling initializePolyhedralFeatures() method)
This commit is contained in:
@@ -208,4 +208,48 @@ const char* btConvexHullShape::serialize(void* dataBuffer, btSerializer* seriali
|
||||
return "btConvexHullShapeData";
|
||||
}
|
||||
|
||||
void btConvexHullShape::project(const btTransform& trans, const btVector3& dir, float& min, float& max) const
|
||||
{
|
||||
#if 1
|
||||
min = FLT_MAX;
|
||||
max = -FLT_MAX;
|
||||
btVector3 witnesPtMin;
|
||||
btVector3 witnesPtMax;
|
||||
|
||||
int numVerts = m_unscaledPoints.size();
|
||||
for(int i=0;i<numVerts;i++)
|
||||
{
|
||||
btVector3 vtx = m_unscaledPoints[i] * m_localScaling;
|
||||
btVector3 pt = trans * vtx;
|
||||
float dp = pt.dot(dir);
|
||||
if(dp < min)
|
||||
{
|
||||
min = dp;
|
||||
witnesPtMin = pt;
|
||||
}
|
||||
if(dp > max)
|
||||
{
|
||||
max = dp;
|
||||
witnesPtMax=pt;
|
||||
}
|
||||
}
|
||||
#else
|
||||
btVector3 localAxis = dir*trans.getBasis();
|
||||
btVector3 vtx1 = trans(localGetSupportingVertex(localAxis));
|
||||
btVector3 vtx2 = trans(localGetSupportingVertex(-localAxis));
|
||||
|
||||
min = vtx1.dot(dir);
|
||||
max = vtx2.dot(dir);
|
||||
#endif
|
||||
|
||||
if(min>max)
|
||||
{
|
||||
float tmp = min;
|
||||
min = max;
|
||||
max = tmp;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user