src/Geometry.cpp File Reference

#include "Geometry.h"
#include <stdio.h>

Include dependency graph for Geometry.cpp:

Go to the source code of this file.

Functions

int sign (double d1)
double max (double d1, double d2)
double min (double d1, double d2)
AngDeg Rad2Deg (AngRad x)
AngRad Deg2Rad (AngDeg x)
double cosDeg (AngDeg x)
double sinDeg (AngDeg x)
double tanDeg (AngDeg x)
AngDeg atanDeg (double x)
double atan2Deg (double x, double y)
AngDeg acosDeg (double x)
AngDeg asinDeg (double x)
bool isAngInInterval (AngDeg ang, AngDeg angMin, AngDeg angMax)
AngDeg getBisectorTwoAngles (AngDeg angMin, AngDeg angMax)
ostream & operator<< (ostream &os, VecPosition v)
ostream & operator<< (ostream &os, Line l)


Detailed Description

File:          Geometry.cpp
Project:       Robocup Soccer Simulation Team: UvA Trilearn
Authors:       Jelle Kok
Created:       13/02/2001
Last Revision: $ID$
Contents:      class declarations of different geometry classes:

Furthermore it contains some goniometric functions to work with sine, cosine
and tangent functions using degrees and some utility functions to return
the maximum and the minimum of two values.

Changes

Date             Author          Comment
12/02/2001       Jelle Kok       Initial version created

Definition in file Geometry.cpp.


Function Documentation

AngDeg acosDeg ( double  x  ) 

This function returns the principal value of the arc cosine of x in degrees using the built-in arc cosine function which returns this value in radians.

Parameters:
x a double value
Returns:
the arc cosine of the given value in degrees

Definition at line 161 of file Geometry.cpp.

References Rad2Deg().

AngDeg asinDeg ( double  x  ) 

This function returns the principal value of the arc sine of x in degrees using the built-in arc sine function which returns this value in radians.

Parameters:
x a double value
Returns:
the arc sine of the given value in degrees

Definition at line 175 of file Geometry.cpp.

References Rad2Deg().

Referenced by BasicPlayer::accelerateBallToVelocity(), and BasicPlayer::kickTo().

double atan2Deg ( double  x,
double  y 
)

This function returns the principal value of the arc tangent of y/x in degrees using the signs of both arguments to determine the quadrant of the return value. For this the built-in 'atan2' function is used which returns this value in radians.

Parameters:
x a double value
y a double value
Returns:
the arc tangent of y/x in degrees taking the signs of x and y into account

Definition at line 149 of file Geometry.cpp.

References EPSILON, and Rad2Deg().

Referenced by WorldModel::calculateAngleAgentWithPos(), getBisectorTwoAngles(), and VecPosition::getDirection().

AngDeg atanDeg ( double  x  ) 

This function returns the principal value of the arc tangent of x in degrees using the built-in arc tangent function which returns this value in radians.

Parameters:
x a double value
Returns:
the arc tangent of the given value in degrees

Definition at line 136 of file Geometry.cpp.

References Rad2Deg().

Referenced by BasicPlayer::canDribbleWithBall(), and BasicPlayer::dribbleWithBall().

double cosDeg ( AngDeg  x  ) 

This function returns the cosine of a given angle in degrees using the built-in cosine function that works with angles in radians.

Parameters:
x an angle in degrees
Returns:
the cosine of the given angle

Definition at line 108 of file Geometry.cpp.

References Deg2Rad().

Referenced by WorldModel::calculateAngleAgentWithPos(), WorldModel::calculateVelocityDynamicObject(), getBisectorTwoAngles(), VecPosition::getVecPositionFromPolar(), WorldModel::initParticlesBall(), and BasicPlayer::isFreeCone().

AngRad Deg2Rad ( AngDeg  x  ) 

This function converts an angle in degrees to the corresponding angle in radians.

Parameters:
x an angle in degrees
Returns:
the corresponding angle in radians

Definition at line 99 of file Geometry.cpp.

Referenced by WorldModel::calculateVelocityDynamicObject(), cosDeg(), WorldModel::initParticlesBall(), sinDeg(), and tanDeg().

AngDeg getBisectorTwoAngles ( AngDeg  angMin,
AngDeg  angMax 
)

This method returns the bisector (average) of two angles. It deals with the boundary problem, thus when 'angMin' equals 170 and 'angMax' equals -100, -145 is returned.

Parameters:
angMin minimum angle [-180,180]
angMax maximum angle [-180,180]
Returns:
average of angMin and angMax.

Definition at line 212 of file Geometry.cpp.

References atan2Deg(), cosDeg(), VecPosition::normalizeAngle(), and sinDeg().

Referenced by WorldModel::getDirectionOfWidestAngle(), and WorldModel::getMarkingPosition().

bool isAngInInterval ( AngDeg  ang,
AngDeg  angMin,
AngDeg  angMax 
)

This function returns a boolean value which indicates whether the value 'ang' (from interval [-180..180] lies in the interval [angMin..angMax]. Examples: isAngInInterval( -100, 4, -150) returns false isAngInInterval( 45, 4, -150) returns true

Parameters:
ang angle that should be checked
angMin minimum angle in interval
angMax maximum angle in interval
Returns:
boolean indicating whether ang lies in [angMin..angMax]

Definition at line 193 of file Geometry.cpp.

Referenced by BasicPlayer::mark(), and BasicPlayer::searchBall().

double max ( double  d1,
double  d2 
)

This function returns the maximum of two given doubles.

Parameters:
d1 first parameter
d2 second parameter
Returns:
the maximum of these two parameters

Definition at line 71 of file Geometry.cpp.

Referenced by BasicPlayer::clearBall(), cFuzzyObj::CountResult(), Object::getConfidence(), WorldModel::getDirectionOfWidestAngle(), WorldModel::getFastestInSetTo(), WorldModel::getMinMaxDistChange(), WorldModel::getOffsideX(), WorldModel::getProbTackleSucceeds(), BasicPlayer::getShootPositionOnLine(), WorldModel::getStrategicPosition(), WorldModel::getTackleExpires(), WorldModel::invQuantizeMin(), Player::makeBallInfo(), WorldModel::predictCommandToInterceptBall(), WorldModel::predictNrCyclesForDistance(), WorldModel::predictNrCyclesToObject(), WorldModel::predictNrCyclesToPoint(), Player::sayOppAttackerStatus(), SenseHandler::SenseHandler(), and Rect::setRectanglePoints().

double min ( double  d1,
double  d2 
)

This function returns the minimum of two given doubles.

Parameters:
d1 first parameter
d2 second parameter
Returns:
the minimum of these two parameters

Definition at line 80 of file Geometry.cpp.

Referenced by cFuzzyObj::CountResult(), WorldModel::createInterceptFeatures(), BasicPlayer::freezeBall(), WorldModel::getDirectionOfWidestAngle(), Circle::getIntersectionArea(), WorldModel::getMarkingPosition(), WorldModel::getMinMaxDistChange(), WorldModel::getProbTackleSucceeds(), BasicPlayer::getShootPositionOnLine(), WorldModel::getStrategicPosition(), Player::makeBallInfo(), BasicPlayer::outplayOpponent(), WorldModel::predictCommandToInterceptBall(), WorldModel::predictCommandTurnTowards(), SenseHandler::SenseHandler(), and Rect::setRectanglePoints().

ostream& operator<< ( ostream &  os,
Line  l 
)

This function prints the line to the specified output stream in the format y = ax + b.

Parameters:
os output stream to which output is written
l line that is written to output stream
Returns:
output sream to which output is appended.

Definition at line 1386 of file Geometry.cpp.

References Line::getACoefficient(), Line::getBCoefficient(), and Line::getCCoefficient().

ostream& operator<< ( ostream &  os,
VecPosition  v 
)

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.

References VecPosition::m_x, and VecPosition::m_y.

AngDeg Rad2Deg ( AngRad  x  ) 

This function converts an angle in radians to the corresponding angle in degrees.

Parameters:
x an angle in radians
Returns:
the corresponding angle in degrees

Definition at line 90 of file Geometry.cpp.

Referenced by acosDeg(), asinDeg(), atan2Deg(), atanDeg(), and WorldModel::checkParticlesBall().

int sign ( double  d1  ) 

This function returns the sign of a give double. 1 is positive, -1 is negative

Parameters:
d1 first parameter
Returns:
the sign of this double

Definition at line 62 of file Geometry.cpp.

Referenced by WorldModel::calculatePosAgentWith2Flags(), WorldModel::calculateStateBall(), BasicPlayer::defendGoalLine(), BasicPlayer::dribble(), Player::getDeadBallPosition(), WorldModel::getMarkingPosition(), Formations::getStrategicPosition(), BasicPlayer::holdBall(), BasicPlayer::interceptScoringAttempt(), BasicPlayer::kickBallCloseToBody(), and WorldModel::updateAgentAndBallAfterSense().

double sinDeg ( AngDeg  x  ) 

This function returns the sine of a given angle in degrees using the built-in sine function that works with angles in radians.

Parameters:
x an angle in degrees
Returns:
the sine of the given angle

Definition at line 117 of file Geometry.cpp.

References Deg2Rad().

Referenced by WorldModel::calculateAngleAgentWithPos(), WorldModel::calculateVelocityDynamicObject(), getBisectorTwoAngles(), VecPosition::getVecPositionFromPolar(), WorldModel::initParticlesBall(), and BasicPlayer::isFreeCone().

double tanDeg ( AngDeg  x  ) 

This function returns the tangent of a given angle in degrees using the built-in tangent function that works with angles in radians.

Parameters:
x an angle in degrees
Returns:
the tangent of the given angle

Definition at line 126 of file Geometry.cpp.

References Deg2Rad().


Generated on Thu Apr 26 22:45:29 2007 for GangOfSix(GOS)-RoboCupTeamProject by  doxygen 1.5.1-p1