more assert issues fixed in Epa
This commit is contained in:
@@ -83,20 +83,29 @@ bool Epa::Initialize( SimplexSolverInterface& simplexSolver )
|
|||||||
delta = v.dot( w );
|
delta = v.dot( w );
|
||||||
|
|
||||||
EPA_DEBUG_ASSERT( ( delta <= 0 ) ,"Shapes are disjoint, EPA should have never been called!" );
|
EPA_DEBUG_ASSERT( ( delta <= 0 ) ,"Shapes are disjoint, EPA should have never been called!" );
|
||||||
|
if ( delta > 0.f )
|
||||||
|
return false;
|
||||||
|
|
||||||
EPA_DEBUG_ASSERT( !simplexSolver.inSimplex( w ) ,"Shapes are disjoint, EPA should have never been called!" );
|
EPA_DEBUG_ASSERT( !simplexSolver.inSimplex( w ) ,"Shapes are disjoint, EPA should have never been called!" );
|
||||||
|
if (simplexSolver.inSimplex( w ))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Add support point to simplex
|
// Add support point to simplex
|
||||||
simplexSolver.addVertex( w, pWorld, qWorld );
|
simplexSolver.addVertex( w, pWorld, qWorld );
|
||||||
|
|
||||||
bool closestOk = simplexSolver.closest( v );
|
bool closestOk = simplexSolver.closest( v );
|
||||||
EPA_DEBUG_ASSERT( closestOk ,"Shapes are disjoint, EPA should have never been called!" );
|
EPA_DEBUG_ASSERT( closestOk ,"Shapes are disjoint, EPA should have never been called!" );
|
||||||
|
if (!closestOk)
|
||||||
|
return false;
|
||||||
|
|
||||||
SimdScalar prevVSqrd = squaredDistance;
|
SimdScalar prevVSqrd = squaredDistance;
|
||||||
squaredDistance = v.length2();
|
squaredDistance = v.length2();
|
||||||
|
|
||||||
// Is v converging to v(A-B) ?
|
// Is v converging to v(A-B) ?
|
||||||
EPA_DEBUG_ASSERT( ( ( prevVSqrd - squaredDistance ) > SIMD_EPSILON * prevVSqrd ) ,
|
EPA_DEBUG_ASSERT( ( ( prevVSqrd - squaredDistance ) > SIMD_EPSILON * prevVSqrd ) ,
|
||||||
"Shapes are disjoint, EPA should have never been called!" );
|
"Shapes are disjoint, EPA should have never been called!" );
|
||||||
|
if (( ( prevVSqrd - squaredDistance ) <= SIMD_EPSILON * prevVSqrd ))
|
||||||
|
return false;
|
||||||
|
|
||||||
if ( simplexSolver.fullSimplex() || ( squaredDistance <= SIMD_EPSILON * simplexSolver.maxVertex() ) )
|
if ( simplexSolver.fullSimplex() || ( squaredDistance <= SIMD_EPSILON * simplexSolver.maxVertex() ) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ bool EpaPenetrationDepthSolver::CalcPenDepth( SimplexSolverInterface& simplexSol
|
|||||||
SimdVector3& v, SimdPoint3& wWitnessOnA, SimdPoint3& wWitnessOnB,
|
SimdVector3& v, SimdPoint3& wWitnessOnA, SimdPoint3& wWitnessOnB,
|
||||||
class IDebugDraw* debugDraw )
|
class IDebugDraw* debugDraw )
|
||||||
{
|
{
|
||||||
assert( pConvexA && "Convex shape A is invalid!" );
|
EPA_DEBUG_ASSERT( pConvexA ,"Convex shape A is invalid!" );
|
||||||
assert( pConvexB && "Convex shape B is invalid!" );
|
EPA_DEBUG_ASSERT( pConvexB ,"Convex shape B is invalid!" );
|
||||||
|
|
||||||
SimdScalar penDepth;
|
SimdScalar penDepth;
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ bool EpaPenetrationDepthSolver::CalcPenDepth( SimplexSolverInterface& simplexSol
|
|||||||
penDepth = EpaPenDepth( simplexSolver, pConvexA, pConvexB,
|
penDepth = EpaPenDepth( simplexSolver, pConvexA, pConvexB,
|
||||||
transformA, transformB,
|
transformA, transformB,
|
||||||
wWitnessOnA, wWitnessOnB );
|
wWitnessOnA, wWitnessOnB );
|
||||||
assert( ( penDepth > 0 ) && "EPA or Hybrid Technique failed to calculate penetration depth!" );
|
EPA_DEBUG_ASSERT( ( penDepth > 0 ) ,"EPA or Hybrid Technique failed to calculate penetration depth!" );
|
||||||
|
|
||||||
#ifdef EPA_USE_HYBRID
|
#ifdef EPA_USE_HYBRID
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ SimdScalar EpaPenetrationDepthSolver::EpaPenDepth( SimplexSolverInterface& simpl
|
|||||||
|
|
||||||
if ( !epa.Initialize( simplexSolver ) )
|
if ( !epa.Initialize( simplexSolver ) )
|
||||||
{
|
{
|
||||||
assert( false && "Epa failed to initialize!" );
|
EPA_DEBUG_ASSERT( false ,"Epa failed to initialize!" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user