QVector ComputeJumpPointArrival( QVector pos, std::string origin, std::string destination )
{
    QVector finish = SystemLocation( destination );
    QVector start  = SystemLocation( origin );
    QVector dir    = finish-start;
    if ( dir.MagnitudeSquared() ) {
        dir.Normalize();
        dir = -dir;
        pos = -pos;
        pos.Normalize();
        if ( pos.MagnitudeSquared() ) pos.Normalize();
        return (dir*.5+pos*.125)*howFarToJump();
    }
    return QVector( 0, 0, 0 );
}
Пример #2
0
float globQuerySphere( QVector start, QVector end, QVector pos, float radius )
{
    QVector st = start-pos;
    if (st.MagnitudeSquared() < radius*radius)
        return 1.0e-6f;
    return globQueryShell( st, end-start, radius );
}