#include <Geometry.h>
Public Methods | |
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) |
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 Methods | |
VecPosition | getVecPositionFromPolar (double dMag, AngDeg ang) |
AngDeg | normalizeAngle (AngDeg angle) |
Private Attributes | |
double | m_x |
double | m_y |
Friends | |
ostream & | operator<< (ostream &os, VecPosition p) |
Definition at line 103 of file Geometry.h.
|
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.
Definition at line 235 of file Geometry.C. References CoordSystemT, and setVecPosition(). Referenced by getVecPositionFromPolar(), operator *(), operator+(), operator-(), and operator/(). |
|
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 629 of file Geometry.C. References AngDeg, atan2Deg(), m_x, and m_y. Referenced by BasicPlayer::accelerateBallToVelocity(), WorldModel::checkParticlesBall(), WorldModel::getBallDirection(), BasicPlayer::getInterceptionPointBall(), Object::getRelativeAngle(), BasicPlayer::kickBallCloseToBody(), BasicPlayer::kickTo(), WorldModel::predictPosAfterNrCycles(), rotate(), BallObject::show(), FixedObject::show(), show(), and str(). |
|
|
This method determines the magnitude (length) of the vector corresponding with the current VecPosition using the formula of Pythagoras.
Definition at line 618 of file Geometry.C. Referenced by BasicPlayer::accelerateBallToVelocity(), WorldModel::calculateStateAgent(), WorldModel::calculateStateBall(), WorldModel::calculateStateBall2(), WorldModel::calculateStatePlayer(), WorldModel::checkParticlesBall(), WorldModel::getBallSpeed(), WorldModel::getClosestInSetTo(), WorldModel::getFurthestInSetTo(), BasicPlayer::getInterceptionPointBall(), Object::getRelativeDistance(), WorldModel::getSecondClosestInSetTo(), DynamicObject::getSpeed(), BasicPlayer::kickBallCloseToBody(), BasicPlayer::kickTo(), WorldModel::predictPosAfterNrCycles(), WorldModel::predictStateAfterDash(), WorldModel::predictStateAfterTurn(), rotate(), DynamicObject::setGlobalVelocity(), setMagnitude(), BallObject::show(), FixedObject::show(), show(), str(), WorldModel::updateAgentAndBallAfterSense(), WorldModel::updateBallAfterKick(), and WorldModel::updateParticlesBall(). |
|
This method converts a polar representation of a VecPosition into a Cartesian representation.
Definition at line 869 of file Geometry.C. References AngDeg, cosDeg(), sinDeg(), and VecPosition(). Referenced by WorldModel::predictStateAfterDash(), and setVecPosition(). |
|
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.
Definition at line 851 of file Geometry.C. Referenced by Circle::getIntersectionArea(). |
|
Get method for the x-coordinate of the current VecPosition.
Definition at line 546 of file Geometry.C. Referenced by WorldModel::averageParticles(), WorldModel::calculateAngleAgentWithPos(), WorldModel::calculatePosAgentWith2Flags(), WorldModel::calculateStateAgent2(), WorldModel::calculateStateBall(), WorldModel::checkParticlesBall(), BasicPlayer::clearBall(), BasicPlayer::defendGoalLine(), Player::deMeer5(), Player::deMeer5_goalie(), BasicPlayer::dribble(), Line::getCircleIntersectionPoints(), WorldModel::getDirectionOfWidestAngle(), SoccerTypes::getGlobalPositionFlag(), Circle::getIntersectionPoints(), WorldModel::getOffsideX(), WorldModel::getOppGoalieType(), WorldModel::getOwnGoalieType(), WorldModel::getPowerForDash(), WorldModel::getStrategicPosition(), Formations::getStrategicPosition(), Line::getTangentLine(), BasicPlayer::interceptScoringAttempt(), WorldModel::isBallHeadingToGoal(), isBehindOf(), isInFrontOf(), WorldModel::isInOwnPenaltyArea(), Rectangle::isInside(), WorldModel::isInTheirPenaltyArea(), WorldModel::isOnside(), BasicPlayer::kickBallCloseToBody(), BasicPlayer::kickTo(), WorldModel::logObjectInformation(), Line::makeLineFromTwoPoints(), BasicPlayer::mark(), BasicPlayer::moveToPosAlongLine(), BasicPlayer::outplayOpponent(), Player::sayBallStatus(), Rectangle::setRectanglePoints(), str(), BasicPlayer::teleportToPos(), WorldModel::updateAgentAndBallAfterSense(), WorldModel::updateBallForCollision(), and WorldModel::updateParticlesAgent(). |
|
Get method for the y-coordinate of the current VecPosition.
Definition at line 562 of file Geometry.C. Referenced by BasicPlayer::accelerateBallToVelocity(), WorldModel::averageParticles(), WorldModel::calculateAngleAgentWithPos(), WorldModel::calculatePosAgentWith2Flags(), WorldModel::calculateStateAgent2(), WorldModel::calculateStateBall(), WorldModel::checkParticlesBall(), BasicPlayer::clearBall(), BasicPlayer::defendGoalLine(), Player::deMeer5_goalie(), BasicPlayer::dribble(), Line::getCircleIntersectionPoints(), WorldModel::getDirectionOfWidestAngle(), SoccerTypes::getGlobalPositionFlag(), Circle::getIntersectionPoints(), WorldModel::getOppGoalieType(), WorldModel::getOuterPositionInField(), WorldModel::getOwnGoalieType(), Formations::getStrategicPosition(), Line::getTangentLine(), BasicPlayer::interceptScoringAttempt(), WorldModel::isBallHeadingToGoal(), WorldModel::isInOwnPenaltyArea(), Rectangle::isInside(), WorldModel::isInTheirPenaltyArea(), isLeftOf(), isRightOf(), BasicPlayer::kickBallCloseToBody(), BasicPlayer::kickTo(), WorldModel::logObjectInformation(), Line::makeLineFromTwoPoints(), BasicPlayer::mark(), BasicPlayer::outplayOpponent(), Player::sayBallStatus(), Rectangle::setRectanglePoints(), str(), BasicPlayer::teleportToPos(), WorldModel::updateAgentAndBallAfterSense(), WorldModel::updateBallForCollision(), and WorldModel::updateParticlesAgent(). |
|
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.
Definition at line 808 of file Geometry.C. References AngDeg, and rotate(). Referenced by WorldModel::checkParticlesBall(), and WorldModel::updateObjectRelativeFromGlobal(). |
|
This method determines whether the x-coordinate of the current VecPosition is behind (i.e. smaller than) a given double value.
Definition at line 671 of file Geometry.C. References m_x. |
|
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.
Definition at line 661 of file Geometry.C. Referenced by isBetweenX(). |
|
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.
Definition at line 737 of file Geometry.C. References isBehindOf(), and isInFrontOf(). |
|
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.
Definition at line 725 of file Geometry.C. References isBehindOf(), and isInFrontOf(). Referenced by Rectangle::isInside(). |
|
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.
Definition at line 763 of file Geometry.C. |
|
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.
Definition at line 750 of file Geometry.C. References isLeftOf(), and isRightOf(). Referenced by Rectangle::isInside(). |
|
This method determines whether the x-coordinate of the current VecPosition is in front of (i.e. larger than) a given double value.
Definition at line 650 of file Geometry.C. References m_x. |
|
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.
Definition at line 640 of file Geometry.C. Referenced by isBetweenX(). |
|
This method determines whether the y-coordinate of the current VecPosition is to the left of (i.e. smaller than) a given double value.
Definition at line 692 of file Geometry.C. References m_y. |
|
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.
Definition at line 682 of file Geometry.C. Referenced by Player::deMeer5_goalie(), and isBetweenY(). |
|
This method determines whether the y-coordinate of the current VecPosition is to the right of (i.e. larger than) a given double value.
Definition at line 713 of file Geometry.C. References m_y. |
|
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.
Definition at line 703 of file Geometry.C. Referenced by Player::deMeer5_goalie(), and isBetweenY(). |
|
This method normalizes a VecPosition by setting the magnitude of the corresponding vector to 1. This thus changes the VecPosition itself.
Definition at line 772 of file Geometry.C. References setMagnitude(). |
|
This method normalizes an angle. This means that the resulting angle lies between -180 and 180 degrees.
Definition at line 879 of file Geometry.C. References AngDeg. Referenced by BasicPlayer::accelerateBallToVelocity(), WorldModel::calculateAngleAgentWithPos(), WorldModel::calculateStateAgent(), WorldModel::checkParticlesAgent(), WorldModel::checkParticlesBall(), BasicPlayer::dribble(), BasicPlayer::freezeBall(), getBisectorTwoAngles(), WorldModel::getDirectionOfWidestAngle(), SoccerTypes::getGlobalAngleLine(), BasicPlayer::getInterceptionPointBall(), WorldModel::getRelativeAngle(), Object::getRelativeAngle(), WorldModel::initParticlesAgent(), BasicPlayer::interceptClose(), BasicPlayer::interceptCloseGoalie(), BasicPlayer::kickBallCloseToBody(), BasicPlayer::moveToPos(), BasicPlayer::moveToPosAlongLine(), BasicPlayer::outplayOpponent(), WorldModel::predictStateAfterCommand(), WorldModel::predictStateAfterDash(), WorldModel::predictStateAfterTurn(), WorldModel::processSeeGlobalInfo(), BasicPlayer::searchBall(), AgentObject::setGlobalNeckAngle(), BasicPlayer::turnBackToPoint(), BasicPlayer::turnBodyToPoint(), BasicPlayer::turnNeckToPoint(), BasicPlayer::turnWithBallTo(), WorldModel::updateBallAfterKick(), WorldModel::updateDynamicObjectAfterSee(), and WorldModel::updateParticlesBall(). |
|
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.
Definition at line 315 of file Geometry.C. References m_x, m_y, and VecPosition(). |
|
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.
Definition at line 304 of file Geometry.C. References m_x, m_y, and VecPosition(). |
|
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.
Definition at line 417 of file Geometry.C. |
|
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.
Definition at line 405 of file Geometry.C. |
|
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.
Definition at line 464 of file Geometry.C. |
|
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.
Definition at line 452 of file Geometry.C. |
|
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.
Definition at line 267 of file Geometry.C. References m_x, m_y, and VecPosition(). |
|
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.
Definition at line 257 of file Geometry.C. References m_x, m_y, and VecPosition(). |
|
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.
Definition at line 369 of file Geometry.C. |
|
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.
Definition at line 357 of file Geometry.C. |
|
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.
Definition at line 292 of file Geometry.C. References m_x, m_y, and VecPosition(). |
|
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.
Definition at line 280 of file Geometry.C. References m_x, m_y, and VecPosition(). |
|
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 244 of file Geometry.C. References m_x, m_y, and VecPosition(). |
|
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.
Definition at line 393 of file Geometry.C. |
|
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.
Definition at line 381 of file Geometry.C. |
|
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.
Definition at line 336 of file Geometry.C. References m_x, m_y, and VecPosition(). |
|
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.
Definition at line 326 of file Geometry.C. References m_x, m_y, and VecPosition(). |
|
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.
Definition at line 440 of file Geometry.C. |
|
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.
Definition at line 428 of file Geometry.C. |
|
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.
Definition at line 346 of file Geometry.C. |
|
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.
Definition at line 487 of file Geometry.C. |
|
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.
Definition at line 475 of file Geometry.C. |
|
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.
Definition at line 830 of file Geometry.C. References AngDeg, and rotate(). Referenced by WorldModel::calculateVelocityDynamicObject(), and WorldModel::initParticlesBall(). |
|
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.
Definition at line 787 of file Geometry.C. References AngDeg, getDirection(), getMagnitude(), and setVecPosition(). Referenced by BasicPlayer::accelerateBallToVelocity(), WorldModel::calculateStateAgent(), WorldModel::calculateStateAgent2(), WorldModel::getPowerForDash(), globalToRelative(), BasicPlayer::kickTo(), relativeToGlobal(), and WorldModel::updateAgentAndBallAfterSense(). |
|
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.
Definition at line 606 of file Geometry.C. References EPSILON, and getMagnitude(). Referenced by WorldModel::calculateStateAgent(), WorldModel::calculateStateBall(), WorldModel::calculateStateBall2(), WorldModel::calculateStatePlayer(), normalize(), WorldModel::predictStateAfterCommand(), WorldModel::predictStateAfterDash(), WorldModel::updateAgentAndBallAfterSense(), WorldModel::updateBallAfterKick(), and WorldModel::updateParticlesBall(). |
|
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.
Definition at line 576 of file Geometry.C. References CoordSystemT, getVecPositionFromPolar(), m_x, and m_y. Referenced by AgentObject::AgentObject(), WorldModel::calculateStateAgent2(), WorldModel::calculateStateBall(), WorldModel::calculateStateBall2(), WorldModel::calculateStatePlayer(), BasicPlayer::clearBall(), Line::getCircleIntersectionPoints(), SoccerTypes::getGlobalPositionFlag(), Circle::getIntersectionPoints(), WorldModel::getStrategicPosition(), WorldModel::initParticlesBall(), BasicPlayer::interceptScoringAttempt(), WorldModel::mapUnknownPlayers(), WorldModel::predictStateAfterCommand(), rotate(), DynamicObject::setGlobalVelocity(), Object::setRelativePosition(), WorldModel::updateAgentAndBallAfterSense(), and VecPosition(). |
|
Set method for the x-coordinate of the current VecPosition.
Definition at line 538 of file Geometry.C. References m_x. Referenced by Player::deMeer5(), Player::deMeer5_goalie(), BasicPlayer::dribble(), WorldModel::getStrategicPosition(), BasicPlayer::mark(), Rectangle::setRectanglePoints(), FormationTypeInfo::setXPosHome(), and WorldModel::updateParticlesAgent(). |
|
Set method for the y-coordinate of the current VecPosition.
Definition at line 554 of file Geometry.C. References m_y. Referenced by WorldModel::calculateStateBall(), BasicPlayer::clearBall(), BasicPlayer::defendGoalLine(), BasicPlayer::dribble(), Rectangle::setRectanglePoints(), FormationTypeInfo::setYPosHome(), and WorldModel::updateParticlesAgent(). |
|
This method writes the current VecPosition to standard output. It can also print a polar representation of the current VecPosition.
Definition at line 508 of file Geometry.C. References CoordSystemT, getDirection(), and getMagnitude(). |
|
This method writes the current VecPosition to a string. It can also write a polar representation of the current VecPosition.
Definition at line 522 of file Geometry.C. References CoordSystemT, getDirection(), getMagnitude(), getX(), and getY(). |
|
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).
Definition at line 499 of file Geometry.C. |
|
x-coordinate of this position Definition at line 108 of file Geometry.h. Referenced by getDirection(), getMagnitude(), isBehindOf(), isInFrontOf(), operator *(), operator *=(), operator!=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), operator=(), operator==(), setVecPosition(), and setX(). |
|
y-coordinate of this position Definition at line 109 of file Geometry.h. Referenced by getDirection(), getMagnitude(), isLeftOf(), isRightOf(), operator *(), operator *=(), operator!=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<<(), operator=(), operator==(), setVecPosition(), and setY(). |