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

Line Class Reference

#include <Geometry.h>

List of all members.

Public Methods

 Line (double a, double b, double c)
void show (ostream &os=cout)
VecPosition getIntersection (Line line)
int getCircleIntersectionPoints (Circle circle, VecPosition *posSolution1, VecPosition *posSolution2)
Line getTangentLine (VecPosition pos)
VecPosition getPointOnLineClosestTo (VecPosition pos)
double getDistanceWithPoint (VecPosition pos)
bool isInBetween (VecPosition pos, VecPosition point1, VecPosition point2)
double getYGivenX (double x)
double getXGivenY (double y)
double getACoefficient () const
double getBCoefficient () const
double getCCoefficient () const

Static Public Methods

Line makeLineFromTwoPoints (VecPosition pos1, VecPosition pos2)
Line makeLineFromPositionAndAngle (VecPosition vec, AngDeg angle)

Private Attributes

double m_a
double m_b
double m_c

Friends

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


Detailed Description

This class contains the representation of a line. A line is defined by the formula ay + bx + c = 0. The coefficients a, b and c are stored and used in the calculations.

Definition at line 267 of file Geometry.h.


Constructor & Destructor Documentation

Line::Line double    dA,
double    dB,
double    dC
 

This constructor creates a line by given the three coefficents of the line. A line is specified by the formula ay + bx + c = 0.

Parameters:
dA  a coefficients of the line
dB  b coefficients of the line
dC  c coefficients of the line

Definition at line 1364 of file Geometry.cpp.

References m_a, m_b, and m_c.

Referenced by getTangentLine(), and makeLineFromTwoPoints().


Member Function Documentation

double Line::getACoefficient   const
 

This method returns the a coefficient from the line ay + bx + c = 0.

Returns:
a coefficient of the line.

Definition at line 1614 of file Geometry.cpp.

References m_a.

Referenced by getIntersection(), and operator<<().

double Line::getBCoefficient   const
 

This method returns the b coefficient from the line ay + bx + c = 0.

Returns:
b coefficient of the line.

Definition at line 1621 of file Geometry.cpp.

References m_b.

Referenced by getIntersection(), and operator<<().

double Line::getCCoefficient   const
 

This method returns the c coefficient from the line ay + bx + c = 0.

Returns:
c coefficient of the line.

Definition at line 1628 of file Geometry.cpp.

References m_c.

Referenced by getIntersection(), and operator<<().

int Line::getCircleIntersectionPoints Circle    circle,
VecPosition   posSolution1,
VecPosition   posSolution2
 

This method calculates the intersection points between the current line and the circle specified with as center 'posCenter' and radius 'dRadius'. The number of solutions are returned and the corresponding points are put in the third and fourth argument of the method

Parameters:
c  circle with which intersection points should be found
posSolution1  first intersection (if any)
posSolution2  second intersection (if any)

Definition at line 1448 of file Geometry.cpp.

References Geometry::abcFormula(), EPSILON, Circle::getCenter(), Circle::getRadius(), VecPosition::getX(), VecPosition::getY(), m_a, m_b, m_c, and VecPosition::setVecPosition().

Referenced by BasicPlayer::interceptClose().

double Line::getDistanceWithPoint VecPosition    pos
 

This method returns the distance between a specified position and the closest point on the given line.

Parameters:
pos  position to which distance should be calculated
Returns:
double indicating the distance to the line.

Definition at line 1519 of file Geometry.cpp.

References VecPosition::getDistanceTo(), and getPointOnLineClosestTo().

Referenced by WorldModel::predictCommandTurnTowards().

VecPosition Line::getIntersection Line    line
 

This method returns the intersection point between the current Line and the specified line.

Parameters:
line  line with which the intersection should be calculated.
Returns:
VecPosition position that is the intersection point.

Definition at line 1409 of file Geometry.cpp.

References getACoefficient(), getBCoefficient(), getCCoefficient(), getYGivenX(), m_a, m_b, and m_c.

Referenced by BasicPlayer::clearBall(), BasicPlayer::defendGoalLine(), Player::deMeer5_goalie(), WorldModel::getOuterPositionInField(), getPointOnLineClosestTo(), BasicPlayer::getShootPositionOnLine(), BasicPlayer::interceptScoringAttempt(), WorldModel::isBallHeadingToGoal(), BasicPlayer::kickBallCloseToBody(), and BasicPlayer::moveToPosAlongLine().

VecPosition Line::getPointOnLineClosestTo VecPosition    pos
 

This method returns the closest point on a line to a given position.

Parameters:
pos  point to which closest point should be determined
Returns:
VecPosition closest point on line to 'pos'.

Definition at line 1509 of file Geometry.cpp.

References getIntersection(), and getTangentLine().

Referenced by WorldModel::getClosestInSetTo(), getDistanceWithPoint(), WorldModel::getMarkingPosition(), WorldModel::getNrInSetInCone(), BasicPlayer::interceptCloseGoalie(), isInBetween(), BasicPlayer::kickTo(), BasicPlayer::moveToPosAlongLine(), and BasicPlayer::outplayOpponent().

Line Line::getTangentLine VecPosition    pos
 

This method returns the tangent line to a VecPosition. This is the line between the specified position and the closest point on the line to this position.

Parameters:
pos  VecPosition point with which tangent line is calculated.
Returns:
Line line tangent to this position

Definition at line 1498 of file Geometry.cpp.

References VecPosition::getX(), VecPosition::getY(), Line(), m_a, and m_b.

Referenced by getPointOnLineClosestTo().

double Line::getXGivenY double    y
 

This method calculates the x coordinate given the x coordinate

Parameters:
y  coordinate
Returns:
x coordinate on this line

Definition at line 1562 of file Geometry.cpp.

References m_a, m_b, and m_c.

double Line::getYGivenX double    x
 

This method calculates the y coordinate given the x coordinate

Parameters:
x  coordinate
Returns:
y coordinate on this line

Definition at line 1546 of file Geometry.cpp.

References m_a, m_b, m_c, and show().

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

bool Line::isInBetween VecPosition    pos,
VecPosition    point1,
VecPosition    point2
 

This method determines whether the projection of a point on the current line lies between two other points ('point1' and 'point2') that lie on the same line.

Parameters:
pos  point of which projection is checked.
point1  first point on line
point2  second point on line
Returns:
true when projection of 'pos' lies between 'point1' and 'point2'.

Definition at line 1532 of file Geometry.cpp.

References VecPosition::getDistanceTo(), and getPointOnLineClosestTo().

Referenced by WorldModel::getClosestInSetTo(), WorldModel::getMarkingPosition(), and WorldModel::getNrInSetInCone().

Line Line::makeLineFromPositionAndAngle VecPosition    vec,
AngDeg    angle
[static]
 

This method creates a line given a position and an angle.

Parameters:
vec  position through which the line passes
angle  direction of the line.
Returns:
line that goes through position 'vec' with angle 'angle'.

Definition at line 1605 of file Geometry.cpp.

References AngDeg, makeLineFromTwoPoints(), and POLAR.

Referenced by BasicPlayer::clearBall(), BasicPlayer::defendGoalLine(), WorldModel::getOuterPositionInField(), BasicPlayer::getShootPositionOnLine(), BasicPlayer::interceptClose(), BasicPlayer::interceptCloseGoalie(), BasicPlayer::interceptScoringAttempt(), WorldModel::isBallHeadingToGoal(), BasicPlayer::kickBallCloseToBody(), BasicPlayer::moveToPosAlongLine(), BasicPlayer::outplayOpponent(), and WorldModel::predictCommandTurnTowards().

Line Line::makeLineFromTwoPoints VecPosition    pos1,
VecPosition    pos2
[static]
 

This method creates a line given two points.

Parameters:
pos1  first point
pos2  second point
Returns:
line that passes through the two specified points.

Definition at line 1577 of file Geometry.cpp.

References EPSILON, VecPosition::getX(), VecPosition::getY(), and Line().

Referenced by BasicPlayer::clearBall(), BasicPlayer::defendGoalLine(), Player::deMeer5_goalie(), WorldModel::getMarkingPosition(), WorldModel::getNrInSetInCone(), BasicPlayer::getShootPositionOnLine(), WorldModel::isBallHeadingToGoal(), BasicPlayer::kickTo(), makeLineFromPositionAndAngle(), and BasicPlayer::moveToPosAlongLine().

void Line::show ostream &    os = cout
 

This method prints the line information to the specified output stream.

Parameters:
os  output stream to which output is written.

Definition at line 1400 of file Geometry.cpp.

Referenced by getYGivenX().


Friends And Related Function Documentation

ostream& operator<< ostream &    os,
Line    l
[friend]
 

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 1376 of file Geometry.cpp.


Member Data Documentation

double Line::m_a [private]
 

This is the a coefficient in the line ay + bx + c = 0

Definition at line 270 of file Geometry.h.

Referenced by getACoefficient(), getCircleIntersectionPoints(), getIntersection(), getTangentLine(), getXGivenY(), getYGivenX(), and Line().

double Line::m_b [private]
 

This is the b coefficient in the line ay + bx + c = 0

Definition at line 271 of file Geometry.h.

Referenced by getBCoefficient(), getCircleIntersectionPoints(), getIntersection(), getTangentLine(), getXGivenY(), getYGivenX(), and Line().

double Line::m_c [private]
 

This is the c coefficient in the line ay + bx + c = 0

Definition at line 272 of file Geometry.h.

Referenced by getCCoefficient(), getCircleIntersectionPoints(), getIntersection(), getXGivenY(), getYGivenX(), and Line().


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