#include <Geometry.h>
Public Member Functions | |
VecPosition (double vx=0, double vy=0, CoordSystemT cs=CARTESIAN) | |
VecPosition | operator- () |
VecPosition | operator+ (const double &d) |
VecPosition | operator+ (const VecPosition &p) |
VecPosition | operator- (const double &d) |
VecPosition | operator- (const VecPosition &p) |
VecPosition | operator * (const double &d) |
VecPosition | operator * (const VecPosition &p) |
VecPosition | operator/ (const double &d) |
VecPosition | operator/ (const VecPosition &p) |
void | operator= (const double &d) |
void | operator+= (const VecPosition &p) |
void | operator+= (const double &d) |
void | operator-= (const VecPosition &p) |
void | operator-= (const double &d) |
void | operator *= (const VecPosition &p) |
void | operator *= (const double &d) |
void | operator/= (const VecPosition &p) |
void | operator/= (const double &d) |
bool | operator!= (const VecPosition &p) |
bool | operator!= (const double &d) |
bool | operator== (const VecPosition &p) |
bool | operator== (const double &d) |
void | show (CoordSystemT cs=CARTESIAN) |
string | str (CoordSystemT cs=CARTESIAN) |
bool | setX (double dX) |
double | getX () const |
bool | setY (double dY) |
double | getY () const |
void | setVecPosition (double dX=0, double dY=0, CoordSystemT cs=CARTESIAN) |
double | getDistanceTo (const VecPosition p) |
double | getDistanceTo (double x, double y) |
VecPosition | setMagnitude (double d) |
double | getMagnitude () const |
AngDeg | getDirection () const |
bool | isInFrontOf (const VecPosition &p) |
bool | isInFrontOf (const double &d) |
bool | isBehindOf (const VecPosition &p) |
bool | isBehindOf (const double &d) |
bool | isLeftOf (const VecPosition &p) |
bool | isLeftOf (const double &d) |
bool | isRightOf (const VecPosition &p) |
bool | isRightOf (const double &d) |
bool | isBetweenX (const VecPosition &p1, const VecPosition &p2) |
bool | isBetweenX (const double &d1, const double &d2) |
bool | isBetweenY (const VecPosition &p1, const VecPosition &p2) |
bool | isBetweenY (const double &d1, const double &d2) |
VecPosition | normalize () |
VecPosition | rotate (AngDeg angle) |
VecPosition | globalToRelative (VecPosition orig, AngDeg ang) |
VecPosition | relativeToGlobal (VecPosition orig, AngDeg ang) |
VecPosition | getVecPositionOnLineFraction (VecPosition &p, double dFrac) |
Static Public Member Functions | |
static VecPosition | getVecPositionFromPolar (double dMag, AngDeg ang) |
static AngDeg | normalizeAngle (AngDeg angle) |
static double | pointsDistance (double x1, double y1, double x2, double y2) |
Private Attributes | |
double | m_x |
double | m_y |
Friends | |
ostream & | operator<< (ostream &os, VecPosition p) |
Definition at line 108 of file Geometry.h.
VecPosition::VecPosition | ( | double | x = 0 , |
|
double | y = 0 , |
|||
CoordSystemT | cs = CARTESIAN | |||
) |
Constructor for the VecPosition class. When the supplied Coordinate System type equals CARTESIAN, the arguments x and y denote the x- and y-coordinates of the new position. When it equals POLAR however, the arguments x and y denote the polar coordinates of the new position; in this case x is thus equal to the distance r from the origin and y is equal to the angle phi that the polar vector makes with the x-axis.
x | the x-coordinate of the new position when cs == CARTESIAN; the distance of the new position from the origin when cs = POLAR | |
y | the y-coordinate of the new position when cs = CARTESIAN; the angle that the polar vector makes with the x-axis when cs = POLAR | |
cs | a CoordSystemT indicating whether x and y denote cartesian coordinates or polar coordinates |
Definition at line 238 of file Geometry.cpp.
References setVecPosition().
Referenced by getVecPositionFromPolar(), operator *(), operator+(), operator-(), and operator/().
VecPosition VecPosition::operator- | ( | ) |
Overloaded version of unary minus operator for VecPositions. It returns the negative VecPosition, i.e. both the x- and y-coordinates are multiplied by -1. The current VecPosition itself is left unchanged.
Definition at line 247 of file Geometry.cpp.
References m_x, m_y, and VecPosition().
VecPosition VecPosition::operator+ | ( | const double & | d | ) |
Overloaded version of the binary plus operator for adding a given double value to a VecPosition. The double value is added to both the x- and y-coordinates of the current VecPosition. The current VecPosition itself is left unchanged.
d | a double value which has to be added to both the x- and y-coordinates of the current VecPosition |
Definition at line 260 of file Geometry.cpp.
References m_x, m_y, and VecPosition().
VecPosition VecPosition::operator+ | ( | const VecPosition & | p | ) |
Overloaded version of the binary plus operator for VecPositions. It returns the sum of the current VecPosition and the given VecPosition by adding their x- and y-coordinates. The VecPositions themselves are left unchanged.
p | a VecPosition |
Definition at line 270 of file Geometry.cpp.
References m_x, m_y, and VecPosition().
VecPosition VecPosition::operator- | ( | const double & | d | ) |
Overloaded version of the binary minus operator for subtracting a given double value from a VecPosition. The double value is subtracted from both the x- and y-coordinates of the current VecPosition. The current VecPosition itself is left unchanged.
d | a double value which has to be subtracted from both the x- and y-coordinates of the current VecPosition |
Definition at line 283 of file Geometry.cpp.
References m_x, m_y, and VecPosition().
VecPosition VecPosition::operator- | ( | const VecPosition & | p | ) |
Overloaded version of the binary minus operator for VecPositions. It returns the difference between the current VecPosition and the given VecPosition by subtracting their x- and y-coordinates. The VecPositions themselves are left unchanged.
p | a VecPosition |
Definition at line 296 of file Geometry.cpp.
References m_x, m_y, and VecPosition().
VecPosition VecPosition::operator * | ( | const double & | d | ) |
Overloaded version of the multiplication operator for multiplying a VecPosition by a given double value. Both the x- and y-coordinates of the current VecPosition are multiplied by this value. The current VecPosition itself is left unchanged.
d | the multiplication factor |
Definition at line 308 of file Geometry.cpp.
References m_x, m_y, and VecPosition().
VecPosition VecPosition::operator * | ( | const VecPosition & | p | ) |
Overloaded version of the multiplication operator for VecPositions. It returns the product of the current VecPosition and the given VecPosition by multiplying their x- and y-coordinates. The VecPositions themselves are left unchanged.
p | a VecPosition |
Definition at line 320 of file Geometry.cpp.
References m_x, m_y, and VecPosition().
VecPosition VecPosition::operator/ | ( | const double & | d | ) |
Overloaded version of the division operator for dividing a VecPosition by a given double value. Both the x- and y-coordinates of the current VecPosition are divided by this value. The current VecPosition itself is left unchanged.
d | the division factor |
Definition at line 333 of file Geometry.cpp.
References m_x, m_y, and VecPosition().
VecPosition VecPosition::operator/ | ( | const VecPosition & | p | ) |
Overloaded version of the division operator for VecPositions. It returns the quotient of the current VecPosition and the given VecPosition by dividing their x- and y-coordinates. The VecPositions themselves are left unchanged.
p | a VecPosition |
Definition at line 345 of file Geometry.cpp.
References m_x, m_y, and VecPosition().
void VecPosition::operator= | ( | const double & | d | ) |
Overloaded version of the assignment operator for assigning a given double value to both the x- and y-coordinates of the current VecPosition. This changes the current VecPosition itself.
d | a double value which has to be assigned to both the x- and y-coordinates of the current VecPosition |
Definition at line 355 of file Geometry.cpp.
void VecPosition::operator+= | ( | const VecPosition & | p | ) |
Overloaded version of the sum-assignment operator for VecPositions. It returns the sum of the current VecPosition and the given VecPosition by adding their x- and y-coordinates. This changes the current VecPosition itself.
p | a VecPosition which has to be added to the current VecPosition |
Definition at line 366 of file Geometry.cpp.
void VecPosition::operator+= | ( | const double & | d | ) |
Overloaded version of the sum-assignment operator for adding a given double value to a VecPosition. The double value is added to both the x- and y-coordinates of the current VecPosition. This changes the current VecPosition itself.
d | a double value which has to be added to both the x- and y-coordinates of the current VecPosition |
Definition at line 378 of file Geometry.cpp.
void VecPosition::operator-= | ( | const VecPosition & | p | ) |
Overloaded version of the difference-assignment operator for VecPositions. It returns the difference between the current VecPosition and the given VecPosition by subtracting their x- and y-coordinates. This changes the current VecPosition itself.
p | a VecPosition which has to be subtracted from the current VecPosition |
Definition at line 391 of file Geometry.cpp.
void VecPosition::operator-= | ( | const double & | d | ) |
Overloaded version of the difference-assignment operator for subtracting a given double value from a VecPosition. The double value is subtracted from both the x- and y-coordinates of the current VecPosition. This changes the current VecPosition itself.
d | a double value which has to be subtracted from both the x- and y-coordinates of the current VecPosition |
Definition at line 404 of file Geometry.cpp.
void VecPosition::operator *= | ( | const VecPosition & | p | ) |
Overloaded version of the multiplication-assignment operator for VecPositions. It returns the product of the current VecPosition and the given VecPosition by multiplying their x- and y-coordinates. This changes the current VecPosition itself.
p | a VecPosition by which the current VecPosition has to be multiplied |
Definition at line 417 of file Geometry.cpp.
void VecPosition::operator *= | ( | const double & | d | ) |
Overloaded version of the multiplication-assignment operator for multiplying a VecPosition by a given double value. Both the x- and y-coordinates of the current VecPosition are multiplied by this value. This changes the current VecPosition itself.
d | a double value by which both the x- and y-coordinates of the current VecPosition have to be multiplied |
Definition at line 430 of file Geometry.cpp.
void VecPosition::operator/= | ( | const VecPosition & | p | ) |
Overloaded version of the division-assignment operator for VecPositions. It returns the quotient of the current VecPosition and the given VecPosition by dividing their x- and y-coordinates. This changes the current VecPosition itself.
p | a VecPosition by which the current VecPosition is divided |
Definition at line 442 of file Geometry.cpp.
void VecPosition::operator/= | ( | const double & | d | ) |
Overloaded version of the division-assignment operator for dividing a VecPosition by a given double value. Both the x- and y-coordinates of the current VecPosition are divided by this value. This changes the current VecPosition itself.
d | a double value by which both the x- and y-coordinates of the current VecPosition have to be divided |
Definition at line 455 of file Geometry.cpp.
bool VecPosition::operator!= | ( | const VecPosition & | p | ) |
Overloaded version of the inequality operator for VecPositions. It determines whether the current VecPosition is unequal to the given VecPosition by comparing their x- and y-coordinates.
p | a VecPosition |
Definition at line 468 of file Geometry.cpp.
bool VecPosition::operator!= | ( | const double & | d | ) |
Overloaded version of the inequality operator for comparing a VecPosition to a double value. It determines whether either the x- or y-coordinate of the current VecPosition is unequal to the given double value.
d | a double value with which both the x- and y-coordinates of the current VecPosition have to be compared. |
Definition at line 482 of file Geometry.cpp.
bool VecPosition::operator== | ( | const VecPosition & | p | ) |
Overloaded version of the equality operator for VecPositions. It determines whether the current VecPosition is equal to the given VecPosition by comparing their x- and y-coordinates.
p | a VecPosition |
Definition at line 495 of file Geometry.cpp.
bool VecPosition::operator== | ( | const double & | d | ) |
Overloaded version of the equality operator for comparing a VecPosition to a double value. It determines whether both the x- and y-coordinates of the current VecPosition are equal to the given double value.
d | a double value with which both the x- and y-coordinates of the current VecPosition have to be compared. |
Definition at line 509 of file Geometry.cpp.
void VecPosition::show | ( | CoordSystemT | cs = CARTESIAN |
) |
This method writes the current VecPosition to standard output. It can also print a polar representation of the current VecPosition.
cs | a CoordSystemtT indicating whether a POLAR or CARTESIAN representation of the current VecPosition should be printed |
Definition at line 532 of file Geometry.cpp.
References CARTESIAN, getDirection(), and getMagnitude().
string VecPosition::str | ( | CoordSystemT | cs = CARTESIAN |
) |
This method writes the current VecPosition to a string. It can also write a polar representation of the current VecPosition.
cs | a CoordSystemtT indicating whether a POLAR or CARTESIAN representation of the current VecPosition should be written |
Definition at line 547 of file Geometry.cpp.
References CARTESIAN, getDirection(), getMagnitude(), getX(), and getY().
bool VecPosition::setX | ( | double | dX | ) |
Set method for the x-coordinate of the current VecPosition.
dX | a double value representing a new x-coordinate |
Definition at line 564 of file Geometry.cpp.
References m_x.
Referenced by Player::deMeer5_goalie(), ArsToolbox::distancePointLine(), BasicPlayer::dribble(), WorldModel::getMarkingPosition(), BasicPlayer::getNrOfBarrierInCone(), WorldModel::getStrategicPosition(), BasicPlayer::isFreeCone(), Player::passTo(), Rect::setRectanglePoints(), FormationTypeInfo::setXPosHome(), and WorldModel::updateParticlesAgent().
double VecPosition::getX | ( | ) | const |
Get method for the x-coordinate of the current VecPosition.
Definition at line 573 of file Geometry.cpp.
References m_x.
Referenced by Player::amIAgentToSaySomething(), WorldModel::calculateAngleAgentWithPos(), WorldModel::calculatePosAgentWith2Flags(), WorldModel::calculateStateAgent2(), WorldModel::calculateStateBall(), BasicPlayer::canDribbleFast(), BasicPlayer::canDribbleSlow(), BasicPlayer::canDribbleWithBall(), WorldModel::checkParticlesBall(), Player::circleKickToPass(), BasicPlayer::clearBall(), ArsToolbox::computeLeastInterceptTime(), WorldModel::coordinateWith(), BasicPlayer::defendGoalLine(), Player::deMeer5(), Player::deMeer5_goalie(), ArsToolbox::distancePointLine(), WorldModel::drawCoordinationGraph(), BasicPlayer::dribble(), BasicPlayer::dribbleWithBall(), Line::getCircleIntersectionPoints(), WorldModel::getDirectionOfWidestAngle(), getDistanceTo(), BasicPlayer::getDribblePoint(), SoccerTypes::getGlobalPositionFlag(), Circle::getIntersectionPoints(), WorldModel::getMarkingPosition(), BasicPlayer::getMarkingPosition(), BasicPlayer::getNrOfBarrierInCone(), WorldModel::getOffsideX(), WorldModel::getOppGoalieType(), WorldModel::getPowerForDash(), WorldModel::getProbTackleSucceeds(), WorldModel::getStrategicPosition(), Formations::getStrategicPosition(), Line::getTangentLine(), BasicPlayer::interceptClose(), BasicPlayer::interceptScoringAttempt(), WorldModel::isBallHeadingToGoal(), isBehindOf(), BasicPlayer::isFreeCone(), isInFrontOf(), Player::isInFrontOfGoalCG(), WorldModel::isInOwnPenaltyArea(), Rect::isInside(), WorldModel::isInTheirPenaltyArea(), WorldModel::isOnside(), BasicPlayer::kickBallCloseToBody(), BasicPlayer::kickTo(), WorldModel::logCircle(), WorldModel::logCoordInfo(), WorldModel::logDrawBallInfo(), WorldModel::logLine(), Player::mainLoop(), Player::makeBallInfo(), Line::makeLineFromTwoPoints(), WorldModel::mapUnknownPlayers(), BasicPlayer::moveToPos(), BasicPlayer::outplayOpponent(), Player::passTo(), Player::performPenalty(), WorldModel::predictCommandToInterceptBall(), WorldModel::predictNrCyclesToPoint(), WorldModel::processPlayerMessage(), Player::sayBallStatus(), Player::sayOppAttackerStatus(), Rect::setRectanglePoints(), str(), BasicPlayer::teleportToPos(), WorldModel::updateAfterSenseMessage(), WorldModel::updateAgentAndBallAfterSense(), WorldModel::updateBallForCollision(), WorldModel::updateDynamicObjectForNextCycle(), and WorldModel::updateParticlesAgent().
bool VecPosition::setY | ( | double | dY | ) |
Set method for the y-coordinate of the current VecPosition.
dY | a double value representing a new y-coordinate |
Definition at line 582 of file Geometry.cpp.
References m_y.
Referenced by WorldModel::calculateStateBall(), BasicPlayer::clearBall(), BasicPlayer::defendGoalLine(), ArsToolbox::distancePointLine(), BasicPlayer::dribble(), WorldModel::getMarkingPosition(), BasicPlayer::getNrOfBarrierInCone(), BasicPlayer::isFreeCone(), Player::passTo(), Rect::setRectanglePoints(), FormationTypeInfo::setYPosHome(), and WorldModel::updateParticlesAgent().
double VecPosition::getY | ( | ) | const |
Get method for the y-coordinate of the current VecPosition.
Definition at line 591 of file Geometry.cpp.
References m_y.
Referenced by WorldModel::averageParticles(), WorldModel::calculateAngleAgentWithPos(), WorldModel::calculatePosAgentWith2Flags(), WorldModel::calculateStateAgent2(), WorldModel::calculateStateBall(), BasicPlayer::canDribbleWithBall(), WorldModel::checkParticlesBall(), Player::circleKickToPass(), BasicPlayer::clearBall(), ArsToolbox::computeLeastInterceptTime(), WorldModel::coordinateWith(), BasicPlayer::defendGoalLine(), Player::deMeer5_goalie(), ArsToolbox::distancePointLine(), WorldModel::drawCoordinationGraph(), BasicPlayer::dribble(), BasicPlayer::dribbleWithBall(), Line::getCircleIntersectionPoints(), Player::getDeadBallPosition(), WorldModel::getDirectionOfWidestAngle(), getDistanceTo(), BasicPlayer::getDribblePoint(), SoccerTypes::getGlobalPositionFlag(), Circle::getIntersectionPoints(), WorldModel::getMarkingPosition(), BasicPlayer::getNrOfBarrierInCone(), WorldModel::getOppGoalieType(), WorldModel::getOuterPositionInField(), WorldModel::getOwnGoalieType(), WorldModel::getProbTackleSucceeds(), Formations::getStrategicPosition(), Line::getTangentLine(), BasicPlayer::interceptScoringAttempt(), WorldModel::isBallHeadingToGoal(), BasicPlayer::isFreeCone(), Player::isInFrontOfGoalCG(), WorldModel::isInOwnPenaltyArea(), Rect::isInside(), WorldModel::isInTheirPenaltyArea(), isLeftOf(), isRightOf(), BasicPlayer::kickBallCloseToBody(), BasicPlayer::kickTo(), Player::kickToScore(), WorldModel::logCircle(), WorldModel::logCoordInfo(), WorldModel::logDrawBallInfo(), WorldModel::logLine(), Player::makeBallInfo(), Line::makeLineFromTwoPoints(), WorldModel::mapUnknownPlayers(), BasicPlayer::moveToPos(), BasicPlayer::outplayOpponent(), Player::passTo(), WorldModel::predictCommandToInterceptBall(), WorldModel::processPlayerMessage(), Player::sayBallStatus(), Player::sayOppAttackerStatus(), Rect::setRectanglePoints(), str(), BasicPlayer::teleportToPos(), WorldModel::updateAfterSenseMessage(), WorldModel::updateAgentAndBallAfterSense(), WorldModel::updateBallForCollision(), WorldModel::updateDynamicObjectForNextCycle(), and WorldModel::updateParticlesAgent().
void VecPosition::setVecPosition | ( | double | dX = 0 , |
|
double | dY = 0 , |
|||
CoordSystemT | cs = CARTESIAN | |||
) |
This method (re)sets the coordinates of the current VecPosition. The given coordinates can either be polar or Cartesian coordinates. This is indicated by the value of the third argument.
dX | a double value indicating either a new Cartesian x-coordinate when cs=CARTESIAN or a new polar r-coordinate (distance) when cs=POLAR | |
dY | a double value indicating either a new Cartesian y-coordinate when cs=CARTESIAN or a new polar phi-coordinate (angle) when cs=POLAR | |
cs | a CoordSystemT indicating whether x and y denote cartesian coordinates or polar coordinates |
Definition at line 611 of file Geometry.cpp.
References CARTESIAN, getVecPositionFromPolar(), m_x, and m_y.
Referenced by AgentObject::AgentObject(), WorldModel::calculateStateAgent2(), WorldModel::calculateStateBall(), BasicPlayer::clearBall(), Line::getCircleIntersectionPoints(), SoccerTypes::getGlobalPositionFlag(), Circle::getIntersectionPoints(), WorldModel::getMarkingPosition(), WorldModel::getStrategicPosition(), WorldModel::initParticlesBall(), BasicPlayer::interceptScoringAttempt(), BasicPlayer::kickTo(), Player::performPenalty(), Player::Player(), WorldModel::predictCommandToInterceptBall(), WorldModel::predictNrCyclesToPoint(), WorldModel::predictStateAfterCommand(), rotate(), Player::sayBallStatus(), DynamicObject::setGlobalVelocity(), Object::setRelativePosition(), WorldModel::updateAgentAndBallAfterSense(), WorldModel::updateDynamicObjectForNextCycle(), and VecPosition().
double VecPosition::getDistanceTo | ( | const VecPosition | p | ) |
This method determines the distance between the current VecPosition and a given VecPosition. This is equal to the magnitude (length) of the vector connecting the two positions which is the difference vector between them.
p | a Vecposition |
Definition at line 630 of file Geometry.cpp.
References getX(), and getY().
Referenced by Player::amIAgentToSaySomething(), BasicPlayer::clearBall(), WorldModel::coordinateWith(), BasicPlayer::defendGoalLine(), Player::deMeer5(), Player::deMeer5_goalie(), WorldModel::drawCoordinationGraph(), BasicPlayer::freezeBall(), BasicPlayer::getActiveInterceptionPointBall(), WorldModel::getClosestInSetTo(), WorldModel::getClosestPlayerInFormationTo(), WorldModel::getDirectionOfWidestAngle(), Line::getDistanceWithPoint(), BasicPlayer::getEndSpeedForPass(), WorldModel::getFastestInSetTo(), BasicPlayer::getInterceptionPointBall(), Circle::getIntersectionArea(), WorldModel::getMarkingPosition(), WorldModel::getNrInSetInCone(), WorldModel::getProbTackleSucceeds(), WorldModel::getRelDistanceOpponentGoal(), BasicPlayer::getShootPositionOnLine(), BasicPlayer::holdBall(), BasicPlayer::interceptClose(), BasicPlayer::interceptCloseGoalie(), BasicPlayer::interceptScoringAttempt(), WorldModel::isCollisionAfterCommand(), Line::isInBetween(), Circle::isInside(), WorldModel::isOpponentAtAngle(), BasicPlayer::kickTo(), WorldModel::mapUnknownPlayers(), BasicPlayer::mark(), BasicPlayer::moveToPos(), BasicPlayer::moveToPosAlongLine(), BasicPlayer::outplayOpponent(), Player::passTo(), Player::passToTeammateFitness(), Player::performPenalty(), WorldModel::predictCommandToInterceptBall(), WorldModel::predictCommandTurnTowards(), WorldModel::predictNrCyclesToObject(), WorldModel::predictNrCyclesToPoint(), WorldModel::processPerfectHearInfoBall(), WorldModel::processPlayerMessage(), WorldModel::processUnsureHearInfo(), WorldModel::removeGhosts(), Player::sayBallStatus(), BasicPlayer::turnWithBallTo(), WorldModel::updateAgentAndBallAfterSense(), and WorldModel::updateDynamicObjectForNextCycle().
double VecPosition::getDistanceTo | ( | double | x, | |
double | y | |||
) |
VecPosition VecPosition::setMagnitude | ( | double | d | ) |
This method adjusts the coordinates of the current VecPosition in such a way that the magnitude of the corresponding vector equals the double value which is supplied as an argument. It thus scales the vector to a given length by multiplying both the x- and y-coordinates by the quotient of the argument and the current magnitude. This changes the VecPosition itself.
d | a double value representing a new magnitude |
Definition at line 652 of file Geometry.cpp.
References EPSILON, and getMagnitude().
Referenced by WorldModel::calculateStateAgent(), WorldModel::calculateStateBall(), WorldModel::calculateStatePlayer(), normalize(), WorldModel::predictBallInfoAfterCommand(), WorldModel::predictStateAfterCommand(), WorldModel::predictStateAfterDash(), and WorldModel::updateAgentAndBallAfterSense().
double VecPosition::getMagnitude | ( | ) | const |
This method determines the magnitude (length) of the vector corresponding with the current VecPosition using the formula of Pythagoras.
Definition at line 666 of file Geometry.cpp.
Referenced by BasicPlayer::accelerateBallToVelocity(), WorldModel::calculateStateAgent(), WorldModel::calculateStateBall(), WorldModel::calculateStatePlayer(), WorldModel::checkParticlesBall(), ArsToolbox::computeLeastInterceptTime(), BasicPlayer::directTowards(), BasicPlayer::getActiveInterceptionPointBall(), WorldModel::getBallSpeed(), WorldModel::getClosestInSetTo(), WorldModel::getFastestInSetTo(), WorldModel::getFurthestInSetTo(), BasicPlayer::getInterceptionPointBall(), Object::getRelativeDistance(), WorldModel::getSecondClosestInSetTo(), DynamicObject::getSpeed(), BasicPlayer::interceptClose(), WorldModel::isCollisionAfterCommand(), BasicPlayer::kickBallCloseToBody(), BasicPlayer::kickTo(), WorldModel::logDrawBallInfo(), WorldModel::predictBallInfoAfterCommand(), WorldModel::predictCommandToInterceptBall(), WorldModel::predictCommandTurnTowards(), WorldModel::predictFinalAgentPos(), WorldModel::predictNrCyclesToPoint(), WorldModel::predictPosAfterNrCycles(), WorldModel::predictStateAfterDash(), WorldModel::predictStateAfterTurn(), rotate(), DynamicObject::setGlobalVelocity(), setMagnitude(), BallObject::show(), FixedObject::show(), show(), str(), WorldModel::updateAgentAndBallAfterSense(), and WorldModel::updateParticlesBall().
AngDeg VecPosition::getDirection | ( | ) | const |
This method determines the direction of the vector corresponding with the current VecPosition (the phi-coordinate in polar representation) using the arc tangent function. Note that the signs of x and y have to be taken into account in order to determine the correct quadrant.
Definition at line 679 of file Geometry.cpp.
References atan2Deg(), m_x, and m_y.
Referenced by BasicPlayer::accelerateBallToVelocity(), WorldModel::checkParticlesBall(), BasicPlayer::getActiveInterceptionPointBall(), WorldModel::getBallDirection(), BasicPlayer::getInterceptionPointBall(), Object::getRelativeAngle(), BasicPlayer::kickBallCloseToBody(), BasicPlayer::kickTo(), WorldModel::logDrawBallInfo(), WorldModel::predictFinalAgentPos(), WorldModel::predictPosAfterNrCycles(), rotate(), BallObject::show(), FixedObject::show(), show(), and str().
bool VecPosition::isInFrontOf | ( | const VecPosition & | p | ) |
This method determines whether the current VecPosition is in front of a given VecPosition, i.e. whether the x-coordinate of the current VecPosition is larger than the x-coordinate of the given VecPosition.
p | a VecPosition to which the current VecPosition must be compared |
Definition at line 692 of file Geometry.cpp.
Referenced by isBetweenX().
bool VecPosition::isInFrontOf | ( | const double & | d | ) |
This method determines whether the x-coordinate of the current VecPosition is in front of (i.e. larger than) a given double value.
d | a double value to which the current x-coordinate must be compared |
Definition at line 706 of file Geometry.cpp.
References m_x.
bool VecPosition::isBehindOf | ( | const VecPosition & | p | ) |
This method determines whether the current VecPosition is behind a given VecPosition, i.e. whether the x-coordinate of the current VecPosition is smaller than the x-coordinate of the given VecPosition.
p | a VecPosition to which the current VecPosition must be compared |
Definition at line 721 of file Geometry.cpp.
Referenced by isBetweenX().
bool VecPosition::isBehindOf | ( | const double & | d | ) |
This method determines whether the x-coordinate of the current VecPosition is behind (i.e. smaller than) a given double value.
d | a double value to which the current x-coordinate must be compared |
Definition at line 734 of file Geometry.cpp.
References m_x.
bool VecPosition::isLeftOf | ( | const VecPosition & | p | ) |
This method determines whether the current VecPosition is to the left of a given VecPosition, i.e. whether the y-coordinate of the current VecPosition is smaller than the y-coordinate of the given VecPosition.
p | a VecPosition to which the current VecPosition must be compared |
Definition at line 749 of file Geometry.cpp.
Referenced by isBetweenY().
bool VecPosition::isLeftOf | ( | const double & | d | ) |
This method determines whether the y-coordinate of the current VecPosition is to the left of (i.e. smaller than) a given double value.
d | a double value to which the current y-coordinate must be compared |
Definition at line 763 of file Geometry.cpp.
References m_y.
bool VecPosition::isRightOf | ( | const VecPosition & | p | ) |
This method determines whether the current VecPosition is to the right of a given VecPosition, i.e. whether the y-coordinate of the current VecPosition is larger than the y-coordinate of the given VecPosition.
p | a VecPosition to which the current VecPosition must be compared |
Definition at line 778 of file Geometry.cpp.
Referenced by isBetweenY().
bool VecPosition::isRightOf | ( | const double & | d | ) |
This method determines whether the y-coordinate of the current VecPosition is to the right of (i.e. larger than) a given double value.
d | a double value to which the current y-coordinate must be compared |
Definition at line 792 of file Geometry.cpp.
References m_y.
bool VecPosition::isBetweenX | ( | const VecPosition & | p1, | |
const VecPosition & | p2 | |||
) |
This method determines whether the current VecPosition is in between two given VecPositions when looking in the x-direction, i.e. whether the current VecPosition is in front of the first argument and behind the second.
p1 | a VecPosition to which the current VecPosition must be compared | |
p2 | a VecPosition to which the current VecPosition must be compared |
Definition at line 811 of file Geometry.cpp.
References isBehindOf(), and isInFrontOf().
Referenced by Rect::isInside().
bool VecPosition::isBetweenX | ( | const double & | d1, | |
const double & | d2 | |||
) |
This method determines whether the x-coordinate of the current VecPosition is in between two given double values, i.e. whether the x-coordinate of the current VecPosition is in front of the first argument and behind the second.
d1 | a double value to which the current x-coordinate must be compared | |
d2 | a double value to which the current x-coordinate must be compared |
Definition at line 829 of file Geometry.cpp.
References isBehindOf(), and isInFrontOf().
bool VecPosition::isBetweenY | ( | const VecPosition & | p1, | |
const VecPosition & | p2 | |||
) |
This method determines whether the current VecPosition is in between two given VecPositions when looking in the y-direction, i.e. whether the current VecPosition is to the right of the first argument and to the left of the second.
p1 | a VecPosition to which the current VecPosition must be compared | |
p2 | a VecPosition to which the current VecPosition must be compared |
Definition at line 848 of file Geometry.cpp.
References isLeftOf(), and isRightOf().
Referenced by Rect::isInside().
bool VecPosition::isBetweenY | ( | const double & | d1, | |
const double & | d2 | |||
) |
This method determines whether the y-coordinate of the current VecPosition is in between two given double values, i.e. whether the y-coordinate of the current VecPosition is to the right of the first argument and to the left of the second.
d1 | a double value to which the current y-coordinate must be compared | |
d2 | a double value to which the current y-coordinate must be compared |
Definition at line 866 of file Geometry.cpp.
References isLeftOf(), and isRightOf().
VecPosition VecPosition::normalize | ( | ) |
This method normalizes a VecPosition by setting the magnitude of the corresponding vector to 1. This thus changes the VecPosition itself.
Definition at line 877 of file Geometry.cpp.
References setMagnitude().
Referenced by ArsToolbox::computeLeastInterceptTime().
VecPosition VecPosition::rotate | ( | AngDeg | angle | ) |
This method rotates the vector corresponding to the current VecPosition over a given angle thereby changing the current VecPosition itself. This is done by calculating the polar coordinates of the current VecPosition and adding the given angle to the phi-coordinate in the polar representation. The polar coordinates are then converted back to Cartesian coordinates to obtain the desired result.
angle | an angle in degrees over which the vector corresponding to the current VecPosition must be rotated |
Definition at line 896 of file Geometry.cpp.
References getDirection(), getMagnitude(), POLAR, and setVecPosition().
Referenced by WorldModel::calculateStateAgent(), WorldModel::calculateStateAgent2(), WorldModel::calculateStateAgent3(), WorldModel::getPowerForDash(), WorldModel::getProbTackleSucceeds(), globalToRelative(), BasicPlayer::kickTo(), WorldModel::predictNrCyclesToPoint(), relativeToGlobal(), and WorldModel::updateAgentAndBallAfterSense().
VecPosition VecPosition::globalToRelative | ( | VecPosition | origin, | |
AngDeg | ang | |||
) |
This method converts the coordinates of the current VecPosition (which are represented in an global coordinate system with the origin at (0,0)) into relative coordinates in a different coordinate system (e.g. relative to a player). The new coordinate system is defined by the arguments to the method. The relative coordinates are now obtained by aligning the relative coordinate system with the global coordinate system using a translation to make both origins coincide followed by a rotation to align the axes.
origin | the origin of the relative coordinate frame | |
ang | the angle between the world frame and the relative frame (reasoning from the world frame) |
Definition at line 922 of file Geometry.cpp.
References rotate().
Referenced by WorldModel::checkParticlesBall(), and WorldModel::updateObjectRelativeFromGlobal().
VecPosition VecPosition::relativeToGlobal | ( | VecPosition | origin, | |
AngDeg | ang | |||
) |
This method converts the coordinates of the current VecPosition (which are represented in a relative coordinate system) into global coordinates in the world frame (with origin at (0,0)). The relative coordinate system is defined by the arguments to the method. The global coordinates are now obtained by aligning the world frame with the relative frame using a rotation to align the axes followed by a translation to make both origins coincide.
origin | the origin of the relative coordinate frame | |
ang | the angle between the world frame and the relative frame (reasoning from the world frame) |
Definition at line 948 of file Geometry.cpp.
References rotate().
Referenced by WorldModel::calculateVelocityDynamicObject(), and WorldModel::initParticlesBall().
VecPosition VecPosition::getVecPositionOnLineFraction | ( | VecPosition & | p, | |
double | dFrac | |||
) |
This method returns a VecPosition that lies somewhere on the vector between the current VecPosition and a given VecPosition. The desired position is specified by a given fraction of this vector (e.g. 0.5 means exactly in the middle of the vector). The current VecPosition itself is left unchanged.
p | a VecPosition which defines the vector to the current VecPosition | |
dFrac | double representing the fraction of the connecting vector at which the desired VecPosition lies. |
Definition at line 974 of file Geometry.cpp.
Referenced by Circle::getIntersectionArea().
VecPosition VecPosition::getVecPositionFromPolar | ( | double | dMag, | |
AngDeg | ang | |||
) | [static] |
This method converts a polar representation of a VecPosition into a Cartesian representation.
dMag | a double representing the polar r-coordinate, i.e. the distance from the point to the origin | |
ang | the angle that the polar vector makes with the x-axis, i.e. the polar phi-coordinate |
Definition at line 996 of file Geometry.cpp.
References cosDeg(), sinDeg(), and VecPosition().
Referenced by WorldModel::calculateStateAgent3(), WorldModel::predictStateAfterDash(), and setVecPosition().
This method normalizes an angle. This means that the resulting angle lies between -180 and 180 degrees.
angle | the angle which must be normalized |
Definition at line 1008 of file Geometry.cpp.
Referenced by BasicPlayer::accelerateBallToVelocity(), SenseHandler::analyzeFullStateMessage(), WorldModel::calculateAngleAgentWithPos(), WorldModel::calculateStateAgent(), WorldModel::calculateStateAgent3(), WorldModel::checkParticlesAgent(), WorldModel::checkParticlesBall(), BasicPlayer::directTowards(), BasicPlayer::dribble(), BasicPlayer::freezeBall(), BasicPlayer::getActiveInterceptionPointBall(), getBisectorTwoAngles(), Player::getDeadBallPosition(), WorldModel::getDirectionOfWidestAngle(), SoccerTypes::getGlobalAngleLine(), BasicPlayer::getInterceptionPointBall(), WorldModel::getProbTackleSucceeds(), WorldModel::getRelativeAngle(), Object::getRelativeAngle(), BasicPlayer::holdBall(), WorldModel::initParticlesAgent(), BasicPlayer::interceptClose(), BasicPlayer::interceptCloseGoalie(), BasicPlayer::kickBallCloseToBody(), WorldModel::logDrawBallInfo(), WorldModel::mapUnknownPlayers(), BasicPlayer::mark(), BasicPlayer::moveToPos(), BasicPlayer::moveToPosAlongLine(), BasicPlayer::oscillateView(), BasicPlayer::outplayOpponent(), Player::performPenalty(), WorldModel::predictBallInfoAfterCommand(), WorldModel::predictCommandTurnTowards(), WorldModel::predictNrCyclesToPoint(), WorldModel::predictStateAfterCommand(), WorldModel::predictStateAfterDash(), WorldModel::predictStateAfterTurn(), WorldModel::processLastSenseMessage(), WorldModel::processSeeGlobalInfo(), WorldModel::removeGhosts(), BasicPlayer::searchBall(), AgentObject::setGlobalNeckAngle(), BasicPlayer::turnBackToPoint(), BasicPlayer::turnBodyToPoint(), BasicPlayer::turnNeckToPoint(), BasicPlayer::turnWithBallTo(), WorldModel::updateDynamicObjectAfterSee(), and WorldModel::updateParticlesBall().
double VecPosition::pointsDistance | ( | double | x1, | |
double | y1, | |||
double | x2, | |||
double | y2 | |||
) | [static] |
ostream& operator<< | ( | ostream & | os, | |
VecPosition | p | |||
) | [friend] |
Overloaded version of the C++ output operator for VecPositions. This operator makes it possible to use VecPositions in output statements (e.g. cout << v). The x- and y-coordinates of the VecPosition are printed in the format (x,y).
os | output stream to which information should be written | |
v | a VecPosition which must be printed |
Definition at line 522 of file Geometry.cpp.
double VecPosition::m_x [private] |
x-coordinate of this position
Definition at line 113 of file Geometry.h.
Referenced by getDirection(), getDistanceTo(), getMagnitude(), getX(), isBehindOf(), isInFrontOf(), operator *(), operator *=(), operator!=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), operator=(), operator==(), setVecPosition(), and setX().
double VecPosition::m_y [private] |
y-coordinate of this position
Definition at line 114 of file Geometry.h.
Referenced by getDirection(), getDistanceTo(), getMagnitude(), getY(), isLeftOf(), isRightOf(), operator *(), operator *=(), operator!=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), operator=(), operator==(), setVecPosition(), and setY().