#include <Geometry.h>
Public Member Functions | |
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 Member Functions | |
static Line | makeLineFromTwoPoints (VecPosition pos1, VecPosition pos2) |
static Line | makeLineFromPositionAndAngle (VecPosition vec, AngDeg angle) |
Private Attributes | |
double | m_a |
double | m_b |
double | m_c |
Friends | |
ostream & | operator<< (ostream &os, Line l) |
Definition at line 273 of file Geometry.h.
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.
dA | a coefficients of the line | |
dB | b coefficients of the line | |
dC | c coefficients of the line |
Definition at line 1374 of file Geometry.cpp.
Referenced by getTangentLine(), and makeLineFromTwoPoints().
void Line::show | ( | ostream & | os = cout |
) |
This method prints the line information to the specified output stream.
os | output stream to which output is written. |
Definition at line 1410 of file Geometry.cpp.
Referenced by getYGivenX().
VecPosition Line::getIntersection | ( | Line | line | ) |
This method returns the intersection point between the current Line and the specified line.
line | line with which the intersection should be calculated. |
Definition at line 1419 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().
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
c | circle with which intersection points should be found | |
posSolution1 | first intersection (if any) | |
posSolution2 | second intersection (if any) |
Definition at line 1458 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().
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.
pos | VecPosition point with which tangent line is calculated. |
Definition at line 1508 of file Geometry.cpp.
References VecPosition::getX(), VecPosition::getY(), Line(), m_a, and m_b.
Referenced by getPointOnLineClosestTo().
VecPosition Line::getPointOnLineClosestTo | ( | VecPosition | pos | ) |
This method returns the closest point on a line to a given position.
pos | point to which closest point should be determined |
Definition at line 1519 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().
double Line::getDistanceWithPoint | ( | VecPosition | pos | ) |
This method returns the distance between a specified position and the closest point on the given line.
pos | position to which distance should be calculated |
Definition at line 1529 of file Geometry.cpp.
References VecPosition::getDistanceTo(), and getPointOnLineClosestTo().
Referenced by WorldModel::predictCommandTurnTowards().
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.
pos | point of which projection is checked. | |
point1 | first point on line | |
point2 | second point on line |
Definition at line 1542 of file Geometry.cpp.
References VecPosition::getDistanceTo(), and getPointOnLineClosestTo().
Referenced by WorldModel::getClosestInSetTo(), WorldModel::getMarkingPosition(), and WorldModel::getNrInSetInCone().
double Line::getYGivenX | ( | double | x | ) |
This method calculates the y coordinate given the x coordinate
x | coordinate |
Definition at line 1556 of file Geometry.cpp.
References m_a, m_b, m_c, and show().
Referenced by getIntersection(), and WorldModel::getMarkingPosition().
double Line::getXGivenY | ( | double | y | ) |
This method calculates the x coordinate given the x coordinate
y | coordinate |
Definition at line 1572 of file Geometry.cpp.
double Line::getACoefficient | ( | ) | const |
This method returns the a coefficient from the line ay + bx + c = 0.
Definition at line 1624 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.
Definition at line 1631 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.
Definition at line 1638 of file Geometry.cpp.
References m_c.
Referenced by getIntersection(), and operator<<().
Line Line::makeLineFromTwoPoints | ( | VecPosition | pos1, | |
VecPosition | pos2 | |||
) | [static] |
This method creates a line given two points.
pos1 | first point | |
pos2 | second point |
Definition at line 1587 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().
Line Line::makeLineFromPositionAndAngle | ( | VecPosition | vec, | |
AngDeg | angle | |||
) | [static] |
This method creates a line given a position and an angle.
vec | position through which the line passes | |
angle | direction of the line. |
Definition at line 1615 of file Geometry.cpp.
References 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().
ostream& operator<< | ( | ostream & | os, | |
Line | l | |||
) | [friend] |
This function prints the line to the specified output stream in the format y = ax + b.
os | output stream to which output is written | |
l | line that is written to output stream |
Definition at line 1386 of file Geometry.cpp.
double Line::m_a [private] |
This is the a coefficient in the line ay + bx + c = 0
Definition at line 276 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 277 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 278 of file Geometry.h.
Referenced by getCCoefficient(), getCircleIntersectionPoints(), getIntersection(), getXGivenY(), getYGivenX(), and Line().