Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

VecPosition Class Reference

#include <Geometry.h>

List of all members.

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)


Detailed Description

This class contains an x- and y-coordinate of a position (x,y) as member data and methods which operate on this position. The standard arithmetic operators are overloaded and can thus be applied to positions (x,y). It is also possible to represent a position in polar coordinates (r,phi), since the class contains a method to convert these into cartesian coordinates (x,y).

Definition at line 108 of file Geometry.h.


Constructor & Destructor Documentation

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.

Parameters:
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
Returns:
the VecPosition corresponding to the given arguments

Definition at line 238 of file Geometry.cpp.

References CoordSystemT, and setVecPosition().

Referenced by getVecPositionFromPolar(), operator *(), operator+(), operator-(), and operator/().


Member Function Documentation

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.

Returns:
the direction in degrees of the vector corresponding with the current VecPosition

Definition at line 674 of file Geometry.cpp.

References AngDeg, 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::predictCommandTurnTowards(), WorldModel::predictFinalAgentPos(), WorldModel::predictPosAfterNrCycles(), rotate(), BallObject::show(), FixedObject::show(), show(), and str().

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.

Parameters:
p  a Vecposition
Returns:
the distance between the current VecPosition and the given VecPosition

Definition at line 630 of file Geometry.cpp.

Referenced by Player::amIAgentToSaySomething(), WorldModel::checkParticlesAgent(), BasicPlayer::clearBall(), BasicPlayer::collideWithBall(), WorldModel::coordinateWith(), WorldModel::createInterceptFeatures(), 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::getListCloseOpponents(), 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::kickBallCloseToBody(), BasicPlayer::kickTo(), WorldModel::logCoordInfo(), WorldModel::mapUnknownPlayers(), BasicPlayer::mark(), BasicPlayer::moveToPos(), BasicPlayer::moveToPosAlongLine(), BasicPlayer::outplayOpponent(), 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::getMagnitude   const
 

This method determines the magnitude (length) of the vector corresponding with the current VecPosition using the formula of Pythagoras.

Returns:
the length of the vector corresponding with the current VecPosition

Definition at line 661 of file Geometry.cpp.

References m_x, and m_y.

Referenced by BasicPlayer::accelerateBallToVelocity(), WorldModel::calculateStateAgent(), WorldModel::calculateStateBall(), WorldModel::calculateStatePlayer(), WorldModel::checkParticlesBall(), BasicPlayer::directTowards(), BasicPlayer::getActiveInterceptionPointBall(), WorldModel::getBallSpeed(), WorldModel::getClosestInSetTo(), WorldModel::getFastestInSetTo(), WorldModel::getFurthestInSetTo(), BasicPlayer::getInterceptionPointBall(), WorldModel::getProbTackleSucceeds(), 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().

VecPosition VecPosition::getVecPositionFromPolar double    dMag,
AngDeg    ang
[static]
 

This method converts a polar representation of a VecPosition into a Cartesian representation.

Parameters:
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
Returns:
the result of converting the given polar representation into a Cartesian representation thus yielding a Cartesian VecPosition

Definition at line 991 of file Geometry.cpp.

References AngDeg, cosDeg(), sinDeg(), and VecPosition().

Referenced by WorldModel::calculateStateAgent3(), WorldModel::predictStateAfterDash(), and setVecPosition().

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.

Parameters:
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.
Returns:
the VecPosition which lies at fraction dFrac on the vector connecting p and the current VecPosition

Definition at line 969 of file Geometry.cpp.

Referenced by Circle::getIntersectionArea().

double VecPosition::getX   const
 

Get method for the x-coordinate of the current VecPosition.

Returns:
the x-coordinate of the current VecPosition

Definition at line 573 of file Geometry.cpp.

Referenced by Player::amIAgentToSaySomething(), WorldModel::averageParticles(), WorldModel::calculateAngleAgentWithPos(), WorldModel::calculatePosAgentWith2Flags(), WorldModel::calculateStateAgent2(), WorldModel::calculateStateBall(), WorldModel::checkParticlesBall(), BasicPlayer::clearBall(), WorldModel::coordinateWith(), BasicPlayer::defendGoalLine(), Player::deMeer5(), Player::deMeer5_goalie(), WorldModel::drawCoordinationGraph(), BasicPlayer::dribble(), Line::getCircleIntersectionPoints(), WorldModel::getClosestPlayerInFormationTo(), WorldModel::getDirectionOfWidestAngle(), BasicPlayer::getDribblePoint(), SoccerTypes::getGlobalPositionFlag(), BasicPlayer::getInterceptionPointBall(), Circle::getIntersectionPoints(), WorldModel::getLastOpponentDefender(), WorldModel::getMarkingPosition(), BasicPlayer::getMarkingPosition(), WorldModel::getOffsideX(), WorldModel::getOppGoalieType(), WorldModel::getOwnGoalieType(), WorldModel::getPowerForDash(), WorldModel::getProbTackleSucceeds(), WorldModel::getStrategicPosition(), Formations::getStrategicPosition(), Line::getTangentLine(), BasicPlayer::interceptClose(), BasicPlayer::interceptScoringAttempt(), WorldModel::isBallHeadingToGoal(), isBehindOf(), isInFrontOf(), WorldModel::isInOwnPenaltyArea(), Rect::isInside(), WorldModel::isInTheirPenaltyArea(), WorldModel::isOnside(), BasicPlayer::kickBallCloseToBody(), BasicPlayer::kickTo(), WorldModel::logCircle(), WorldModel::logCoordInfo(), WorldModel::logDrawBallInfo(), WorldModel::logDrawInfo(), WorldModel::logLine(), WorldModel::logObjectInformation(), Player::mainLoop(), Player::makeBallInfo(), Line::makeLineFromTwoPoints(), WorldModel::mapUnknownPlayers(), BasicPlayer::moveToPos(), BasicPlayer::outplayOpponent(), 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().

double VecPosition::getY   const
 

Get method for the y-coordinate of the current VecPosition.

Returns:
the y-coordinate of the current VecPosition

Definition at line 591 of file Geometry.cpp.

Referenced by BasicPlayer::accelerateBallToVelocity(), WorldModel::averageParticles(), WorldModel::calculateAngleAgentWithPos(), WorldModel::calculatePosAgentWith2Flags(), WorldModel::calculateStateAgent2(), WorldModel::calculateStateBall(), WorldModel::checkParticlesBall(), BasicPlayer::clearBall(), WorldModel::coordinateWith(), BasicPlayer::defendGoalLine(), Player::deMeer5_goalie(), WorldModel::drawCoordinationGraph(), BasicPlayer::dribble(), Line::getCircleIntersectionPoints(), Player::getDeadBallPosition(), WorldModel::getDirectionOfWidestAngle(), BasicPlayer::getDribblePoint(), SoccerTypes::getGlobalPositionFlag(), BasicPlayer::getInterceptionPointBall(), Circle::getIntersectionPoints(), WorldModel::getMarkingPosition(), WorldModel::getOppGoalieType(), WorldModel::getOuterPositionInField(), WorldModel::getOwnGoalieType(), WorldModel::getProbTackleSucceeds(), Formations::getStrategicPosition(), Line::getTangentLine(), BasicPlayer::interceptScoringAttempt(), WorldModel::isBallHeadingToGoal(), WorldModel::isInOwnPenaltyArea(), Rect::isInside(), WorldModel::isInTheirPenaltyArea(), isLeftOf(), isRightOf(), BasicPlayer::kickBallCloseToBody(), BasicPlayer::kickTo(), WorldModel::logCircle(), WorldModel::logCoordInfo(), WorldModel::logDrawBallInfo(), WorldModel::logDrawInfo(), WorldModel::logLine(), WorldModel::logObjectInformation(), Player::makeBallInfo(), Line::makeLineFromTwoPoints(), WorldModel::mapUnknownPlayers(), BasicPlayer::moveToPos(), BasicPlayer::outplayOpponent(), WorldModel::predictCommandToInterceptBall(), WorldModel::processPlayerMessage(), Player::sayBallStatus(), Player::sayOppAttackerStatus(), Rect::setRectanglePoints(), str(), BasicPlayer::teleportToPos(), WorldModel::updateAfterSenseMessage(), WorldModel::updateAgentAndBallAfterSense(), WorldModel::updateBallForCollision(), WorldModel::updateDynamicObjectForNextCycle(), and WorldModel::updateParticlesAgent().

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.

Parameters:
origin  the origin of the relative coordinate frame
ang  the angle between the world frame and the relative frame (reasoning from the world frame)
Returns:
the result of converting the current global VecPosition into a relative VecPosition

Definition at line 917 of file Geometry.cpp.

References AngDeg, and rotate().

Referenced by WorldModel::checkParticlesBall(), and WorldModel::updateObjectRelativeFromGlobal().

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.

Parameters:
d  a double value to which the current x-coordinate must be compared
Returns:
true when the current x-coordinate is behind the given value; false otherwise

Definition at line 729 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.

Parameters:
p  a VecPosition to which the current VecPosition must be compared
Returns:
true when the current VecPosition is behind the given VecPosition; false otherwise

Definition at line 716 of file Geometry.cpp.

References getX(), and m_x.

Referenced by isBetweenX().

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.

Parameters:
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
Returns:
true when the current x-coordinate is in between the two given values; false otherwise

Definition at line 824 of file Geometry.cpp.

References isBehindOf(), and isInFrontOf().

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.

Parameters:
p1  a VecPosition to which the current VecPosition must be compared
p2  a VecPosition to which the current VecPosition must be compared
Returns:
true when the current VecPosition is in between the two given VecPositions when looking in the x-direction; false otherwise

Definition at line 806 of file Geometry.cpp.

References isBehindOf(), and isInFrontOf().

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.

Parameters:
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
Returns:
true when the current y-coordinate is in between the two given values; false otherwise

Definition at line 861 of file Geometry.cpp.

References isLeftOf(), and isRightOf().

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.

Parameters:
p1  a VecPosition to which the current VecPosition must be compared
p2  a VecPosition to which the current VecPosition must be compared
Returns:
true when the current VecPosition is in between the two given VecPositions when looking in the y-direction; false otherwise

Definition at line 843 of file Geometry.cpp.

References isLeftOf(), and isRightOf().

Referenced by Rect::isInside().

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.

Parameters:
d  a double value to which the current x-coordinate must be compared
Returns:
true when the current x-coordinate is in front of the given value; false otherwise

Definition at line 701 of file Geometry.cpp.

References m_x.

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.

Parameters:
p  a VecPosition to which the current VecPosition must be compared
Returns:
true when the current VecPosition is in front of the given VecPosition; false otherwise

Definition at line 687 of file Geometry.cpp.

References getX(), and m_x.

Referenced by isBetweenX().

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.

Parameters:
d  a double value to which the current y-coordinate must be compared
Returns:
true when the current y-coordinate is to the left of the given value; false otherwise

Definition at line 758 of file Geometry.cpp.

References m_y.

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.

Parameters:
p  a VecPosition to which the current VecPosition must be compared
Returns:
true when the current VecPosition is to the left of the given VecPosition; false otherwise

Definition at line 744 of file Geometry.cpp.

References getY(), and m_y.

Referenced by Player::deMeer5_goalie(), and 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.

Parameters:
d  a double value to which the current y-coordinate must be compared
Returns:
true when the current y-coordinate is to the right of the given value; false otherwise

Definition at line 787 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.

Parameters:
p  a VecPosition to which the current VecPosition must be compared
Returns:
true when the current VecPosition is to the right of the given VecPosition; false otherwise

Definition at line 773 of file Geometry.cpp.

References getY(), and m_y.

Referenced by Player::deMeer5_goalie(), and isBetweenY().

VecPosition VecPosition::normalize  
 

This method normalizes a VecPosition by setting the magnitude of the corresponding vector to 1. This thus changes the VecPosition itself.

Returns:
the result of normalizing the current VecPosition thus yielding a different VecPosition

Definition at line 872 of file Geometry.cpp.

References setMagnitude().

AngDeg VecPosition::normalizeAngle AngDeg    angle [static]
 

This method normalizes an angle. This means that the resulting angle lies between -180 and 180 degrees.

Parameters:
angle  the angle which must be normalized
Returns:
the result of normalizing the given angle

Definition at line 1003 of file Geometry.cpp.

References AngDeg.

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::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().

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.

Parameters:
p  a VecPosition
Returns:
the product of the current VecPosition and the given 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 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.

Parameters:
d  the multiplication factor
Returns:
the result of multiplying the current VecPosition by the given double value

Definition at line 308 of file Geometry.cpp.

References m_x, m_y, and VecPosition().

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.

Parameters:
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.

References m_x, and m_y.

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.

Parameters:
p  a VecPosition by which the current VecPosition has to be multiplied

Definition at line 417 of file Geometry.cpp.

References m_x, and m_y.

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.

Parameters:
d  a double value with which both the x- and y-coordinates of the current VecPosition have to be compared.
Returns:
true when either the x- or y-coordinate of the current VecPosition is unequal to the given double value; false otherwise

Definition at line 482 of file Geometry.cpp.

References m_x, and m_y.

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.

Parameters:
p  a VecPosition
Returns:
true when either the x- or y-coordinates of the given VecPosition and the current VecPosition are different; false otherwise

Definition at line 468 of file Geometry.cpp.

References m_x, and m_y.

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.

Parameters:
p  a VecPosition
Returns:
the sum of the current VecPosition and the given 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 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.

Parameters:
d  a double value which has to be added to both the x- and y-coordinates of the current VecPosition
Returns:
the result of adding the given double value to the current VecPosition

Definition at line 260 of file Geometry.cpp.

References m_x, m_y, and VecPosition().

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.

Parameters:
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.

References m_x, and m_y.

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.

Parameters:
p  a VecPosition which has to be added to the current VecPosition

Definition at line 366 of file Geometry.cpp.

References m_x, and m_y.

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.

Parameters:
p  a VecPosition
Returns:
the difference between the current VecPosition and the given 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 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.

Parameters:
d  a double value which has to be subtracted from both the x- and y-coordinates of the current VecPosition
Returns:
the result of subtracting the given double value from the current VecPosition

Definition at line 283 of file Geometry.cpp.

References m_x, m_y, and VecPosition().

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.

Returns:
a negated version of the current VecPosition

Definition at line 247 of file Geometry.cpp.

References m_x, m_y, and VecPosition().

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.

Parameters:
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.

References m_x, and m_y.

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.

Parameters:
p  a VecPosition which has to be subtracted from the current VecPosition

Definition at line 391 of file Geometry.cpp.

References m_x, and m_y.

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.

Parameters:
p  a VecPosition
Returns:
the quotient of the current VecPosition and the given one

Definition at line 345 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.

Parameters:
d  the division factor
Returns:
the result of dividing the current VecPosition by the given double value

Definition at line 333 of file Geometry.cpp.

References m_x, m_y, and VecPosition().

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.

Parameters:
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.

References m_x, and m_y.

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.

Parameters:
p  a VecPosition by which the current VecPosition is divided

Definition at line 442 of file Geometry.cpp.

References m_x, and m_y.

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.

Parameters:
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.

References m_x, and m_y.

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.

Parameters:
d  a double value with which both the x- and y-coordinates of the current VecPosition have to be compared.
Returns:
true when both the x- and y-coordinates of the current VecPosition are equal to the given double value; false otherwise

Definition at line 509 of file Geometry.cpp.

References m_x, and m_y.

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.

Parameters:
p  a VecPosition
Returns:
true when both the x- and y-coordinates of the given VecPosition and the current VecPosition are equal; false otherwise

Definition at line 495 of file Geometry.cpp.

References m_x, and m_y.

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.

Parameters:
origin  the origin of the relative coordinate frame
ang  the angle between the world frame and the relative frame (reasoning from the world frame)
Returns:
the result of converting the current relative VecPosition into an global VecPosition

Definition at line 943 of file Geometry.cpp.

References AngDeg, and rotate().

Referenced by WorldModel::calculateVelocityDynamicObject(), and WorldModel::initParticlesBall().

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.

Parameters:
angle  an angle in degrees over which the vector corresponding to the current VecPosition must be rotated
Returns:
the result of rotating the vector corresponding to the current VecPosition over the given angle thus yielding a different VecPosition

Definition at line 891 of file Geometry.cpp.

References AngDeg, getDirection(), getMagnitude(), POLAR, and setVecPosition().

Referenced by BasicPlayer::accelerateBallToVelocity(), WorldModel::calculateStateAgent(), WorldModel::calculateStateAgent2(), WorldModel::calculateStateAgent3(), WorldModel::getPowerForDash(), WorldModel::getProbTackleSucceeds(), globalToRelative(), BasicPlayer::kickTo(), WorldModel::predictNrCyclesToPoint(), relativeToGlobal(), and WorldModel::updateAgentAndBallAfterSense().

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.

Parameters:
d  a double value representing a new magnitude
Returns:
the result of scaling the vector corresponding with the current VecPosition to the given magnitude thus yielding a different VecPosition

Definition at line 647 of file Geometry.cpp.

References EPSILON, and getMagnitude().

Referenced by WorldModel::calculateStateAgent(), WorldModel::calculateStateBall(), WorldModel::calculateStatePlayer(), normalize(), WorldModel::predictBallInfoAfterCommand(), WorldModel::predictStateAfterCommand(), WorldModel::predictStateAfterDash(), WorldModel::updateAgentAndBallAfterSense(), and WorldModel::updateParticlesBall().

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.

Parameters:
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, CoordSystemT, 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(), WorldModel::predictCommandToInterceptBall(), WorldModel::predictNrCyclesToPoint(), WorldModel::predictStateAfterCommand(), rotate(), Player::sayBallStatus(), DynamicObject::setGlobalVelocity(), Object::setRelativePosition(), WorldModel::updateAgentAndBallAfterSense(), WorldModel::updateDynamicObjectForNextCycle(), and VecPosition().

bool VecPosition::setX double    dX
 

Set method for the x-coordinate of the current VecPosition.

Parameters:
dX  a double value representing a new x-coordinate
Returns:
a boolean indicating whether the update was successful

Definition at line 564 of file Geometry.cpp.

References m_x.

Referenced by Player::deMeer5_goalie(), BasicPlayer::dribble(), WorldModel::getMarkingPosition(), WorldModel::getStrategicPosition(), Rect::setRectanglePoints(), FormationTypeInfo::setXPosHome(), and WorldModel::updateParticlesAgent().

bool VecPosition::setY double    dY
 

Set method for the y-coordinate of the current VecPosition.

Parameters:
dY  a double value representing a new y-coordinate
Returns:
a boolean indicating whether the update was successful

Definition at line 582 of file Geometry.cpp.

References m_y.

Referenced by WorldModel::calculateStateBall(), BasicPlayer::clearBall(), BasicPlayer::defendGoalLine(), BasicPlayer::dribble(), WorldModel::getMarkingPosition(), Rect::setRectanglePoints(), FormationTypeInfo::setYPosHome(), and WorldModel::updateParticlesAgent().

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.

Parameters:
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, CoordSystemT, 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.

Parameters:
cs  a CoordSystemtT indicating whether a POLAR or CARTESIAN representation of the current VecPosition should be written
Returns:
a string containing a polar or Cartesian representation of the current VecPosition depending on the value of the boolean argument

Definition at line 547 of file Geometry.cpp.

References CARTESIAN, CoordSystemT, getDirection(), getMagnitude(), getX(), and getY().


Friends And Related Function Documentation

ostream& operator<< ostream &    os,
VecPosition    v
[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).

Parameters:
os  output stream to which information should be written
v  a VecPosition which must be printed
Returns:
output stream containing (x,y)

Definition at line 522 of file Geometry.cpp.


Member Data Documentation

double VecPosition::m_x [private]
 

x-coordinate of this position

Definition at line 113 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().

double VecPosition::m_y [private]
 

y-coordinate of this position

Definition at line 114 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().


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 11:46:08 2003 for UvA Trilearn 2003 Base Code by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001