Util::Vector SteerLib::GJK_EPA::Support(const std::vector<Util::Vector>& _shapeA, const std::vector<Util::Vector>& _shapeB, Util::Vector d)
{
	Util::Vector A = _shapeA[GetFarthest(_shapeA, d)];
	Util::Vector B = _shapeB[GetFarthest(_shapeB, (d * -1))];

	return A - B;
}
Example #2
0
float plAnimPath::ICheckInterval(hsPoint3 &pt) const
{
    if( fDelTime <= kTerminateDelTime &&
        hsVector3(&fCurPos, &fPrevPos).MagnitudeSquared() < kTerminateDelDistSq)
    {
        return IBestTime();
    }

    if( fThisTime < 0 )
        return 0;

    if( fThisTime > fLength )
        return fLength;

    if( GetFarthest() )
    {
        if( (fLastDistSq > fThisDistSq)&&(fLastDistSq >= fNextDistSq) )
            return IShiftBack(pt);

        if( (fNextDistSq > fThisDistSq)&&(fNextDistSq >= fLastDistSq) )
            return IShiftFore(pt);

        if( (fThisDistSq >= fLastDistSq)&&(fLastDistSq >= fNextDistSq) )
            return ISubDivBack(pt);

        if( (fThisDistSq >= fNextDistSq)&&(fNextDistSq >= fLastDistSq) )
            return ISubDivFore(pt);
    }
    else
    {
        if( (fLastDistSq < fThisDistSq)&&(fLastDistSq <= fNextDistSq) )
            return IShiftBack(pt);

        if( (fNextDistSq < fThisDistSq)&&(fNextDistSq <= fLastDistSq) )
            return IShiftFore(pt);

        if( (fThisDistSq <= fLastDistSq)&&(fLastDistSq <= fNextDistSq) )
            return ISubDivBack(pt);

        if( (fThisDistSq <= fNextDistSq)&&(fNextDistSq <= fLastDistSq) )
            return ISubDivFore(pt);
    }

    hsAssert(false, "Shouldn't have gotten here");
    return 0;
}