void CFBMatch::updateDefendPlayerAroundBall() { m_defendPlayerIds.clear(); auto ballPos = FBMATCH->getBallPosition(); auto defTeam = getDefendingTeam(); auto& teamMembers = defTeam->getTeamMembers(); for (auto tm : teamMembers) { if (!tm->m_isGoalKeeper) { if (FLT_LE(ballPos.getDistanceSq(tm->getPosition()), m_playerDistanceSq)) { m_defendPlayerIds.insert(tm->m_positionInFormation); } } } }
/*! \brief Gets the distance between this point and another vector. Uses getDistanceSq(). \param origin The other vector. \return The distance between the vectors. */ int64_t Vector3d::getDistance(const Vector3d & origin) const{ return (int64_t)sqrt(getDistanceSq(origin)); }
bool Point::isWithinBounds(const QPointF p2, float epsilon) const { return (getDistanceSq(p2) < epsilon * epsilon); }