コード例 #1
0
bool jfCollisionDetector_x86::tryAxis(
    const jfCollisionBox& one,
    const jfCollisionBox& two,
    jfVector3& axis,
    const jfVector3& toCentre,
    unsigned index,
    // These values may be updated
    jfReal& smallestPenetration,
    unsigned& smallestCase
    ) const
{
    // Make sure we have a normalized axis, and don't check almost parallel axes
    if (axis.squareMagnitude() < 0.0001)
	{
		return true;
	}
    axis.normalize();

    jfReal penetration = penetrationOnAxis(one, two, axis, toCentre);

    if (penetration < 0)
	{
		return false;
	}
    if (penetration < smallestPenetration)
	{
        smallestPenetration = penetration;
        smallestCase = index;
    }
    return true;
}
コード例 #2
0
ファイル: collide_fine.cpp プロジェクト: jobgsk/CppGameEngine
static inline bool tryAxis(
    const CollisionBox &one,
    const CollisionBox &two,
    Vector3 axis,
    const Vector3& toCentre,
    unsigned index,

    // These values may be updated
    real& smallestPenetration,
    unsigned &smallestCase
    )
{
    // Make sure we have a normalized axis, and don't check almost parallel axes
    if (axis.squareMagnitude() < 0.0001) return true;
    axis.normalise();

    real penetration = penetrationOnAxis(one, two, axis, toCentre);

    if (penetration < 0) return false;
    if (penetration < smallestPenetration) {
        smallestPenetration = penetration;
        smallestCase = index;
    }
    return true;
}
コード例 #3
0
ファイル: ContactGenerator.cpp プロジェクト: TurpinL/ltPhys
static inline bool tryAxis(const ShapeBox &boxA, const Transform &boxATransform, 
	const ShapeBox &boxB, const Transform &boxBTransform, Vec3 axis, 
	const Vec3 &separation, unsigned int index, Scalar &smallestPenetration, unsigned int &smallestCase)
{
	// Omit almost parallel axes and normalize
	if (axis.dot(axis) < 0.0001) return true;
	axis.normalize();

	Scalar penetration = penetrationOnAxis(boxA, boxATransform, boxB, boxBTransform, axis, separation);

	if (penetration < 0) return false;

	if(penetration < smallestPenetration)
	{
		smallestPenetration = penetration;
		smallestCase = index;
	}

	return true;
}