Field Class Reference

#include <Field.h>

Inheritance diagram for Field:

Boundary< double > List of all members.

Public Member Functions

 Field ()
bool isReallyInside (const Vector2< double > &v) const
double clip (Vector2< double > &v) const
Vector2< double > getClosestPoint (const Vector2< double > &v, LinesPercept::LineType type) const
Vector2< double > getClosestPoint (const Pose2D &p, int numberOfRotations, LinesPercept::LineType type) const
double getClosestDistance (const Vector2< double > &v, LinesPercept::LineType type) const
double getDistance (const Pose2D &pose, LinesPercept::LineType type) const
double getDistance (const Pose2D &pose, bool ignoreFieldLines=false) const
double getDistanceToOwnPenaltyArea (const Pose2D &pose) const
double getDistanceToBorder (const Pose2D &pose) const
double getDistanceToBoundary (const Pose2D &pose) const
double getObstacleDistance (const Pose2D &pose, ObstaclesPercept::ObstacleType &obstacleType) const
void placePlayers (const PlayerPoseCollection &ppc)
Pose2D randomPose () const
void draw (const Drawings::Color color, LinesPercept::LineType type) const

Private Member Functions

void initBoundary (Table &table)
void initLines (Table &table, Table &xTable, Table &yTable)
void initBorder (Table &table)
void initOpponentGoal (Table &table)
void initOwnGoal (Table &table)
void initSimpleLines (Table &table)
void initOwnPenaltyArea (Table &table)
void initOpponentPenaltyArea (Table &table)
void addCoords (Table &table, int number, double *x, double *y)
void addCoords (Table &table, Table &xTable, Table &yTable, int number, double *x, double *y)
void addPlayer (const Pose2D &pose)

Private Attributes

Table boundary
Table lines [LinesPercept::numberOfLineTypes+6]

Classes

class  Table

Detailed Description

The class represents the field area.

Definition at line 29 of file Field.h.


Constructor & Destructor Documentation

Field::Field (  ) 

Constructor.

Definition at line 23 of file Field.cpp.

References Boundary< double >::add(), LinesPercept::border, boundary, LinesPercept::field, initBorder(), initBoundary(), initLines(), initOpponentGoal(), initOpponentPenaltyArea(), initOwnGoal(), initOwnPenaltyArea(), initSimpleLines(), lines, LinesPercept::numberOfLineTypes, LinesPercept::skyblueGoal, and LinesPercept::yellowGoal.


Member Function Documentation

void Field::addCoords ( Table table,
Table xTable,
Table yTable,
int  number,
double *  x,
double *  y 
) [private]

Definition at line 491 of file Field.cpp.

References Field::Table::push(), and table.

void Field::addCoords ( Table table,
int  number,
double *  x,
double *  y 
) [private]

Definition at line 479 of file Field.cpp.

References table.

Referenced by addPlayer(), initBorder(), initBoundary(), initLines(), initOpponentGoal(), initOpponentPenaltyArea(), initOwnGoal(), initOwnPenaltyArea(), and initSimpleLines().

void Field::addPlayer ( const Pose2D pose  )  [private]

Definition at line 774 of file Field.cpp.

References addCoords(), RobotDimensions::bodyLength, getRobotConfiguration(), RobotConfiguration::getRobotDimensions(), RobotDimensions::lengthNeckToBodyCenter, lines, LinesPercept::numberOfLineTypes, RobotDimensions::overallBodyWidth, Vector2< V >::x, Boundary< double >::x, Vector2< V >::y, and Boundary< double >::y.

Referenced by placePlayers().

double Field::clip ( Vector2< double > &  v  )  const

The function clips a point to the field.

Parameters:
v The point.
Returns:
How far was the point moved?

Definition at line 522 of file Field.cpp.

References Vector2< V >::abs(), boundary, Field::Table::corner, dist(), isReallyInside(), Field::Table::length, Field::Table::numberOfEntries, and Pose2D::translation.

Referenced by GT2004SelfLocator::calcPose().

void Field::draw ( const Drawings::Color  color,
LinesPercept::LineType  type 
) const

The function draws all lines of a cetain type. It is use to control the correctness of the model.

Parameters:
color The color the lines will be drawn in.
type The type of the lines.

Definition at line 799 of file Field.cpp.

References LINE, lines, Drawings::ps_solid, table, and Vector2< V >::x.

double Field::getClosestDistance ( const Vector2< double > &  v,
LinesPercept::LineType  type 
) const

The function returns the distance between a point and the closest point on a line of a certain type.

Parameters:
v The reference point.
type The type of the lines.
Returns:
The distance.

Definition at line 626 of file Field.cpp.

References getClosestPoint().

Vector2< double > Field::getClosestPoint ( const Pose2D p,
int  numberOfRotations,
LinesPercept::LineType  type 
) const

The function returns the point on a line of a certain type closest to given a point.

Parameters:
p The reference point and the rotation of the line.
numberOfRotations The number of discretizations of line rotations.
type The type of the lines.
Returns:
The point on a line.

Definition at line 578 of file Field.cpp.

References ASSERT, dist(), LinesPercept::field, int(), lines, normalize(), pi2, pi_2, Pose2D::rotation, table, and Pose2D::translation.

Vector2< double > Field::getClosestPoint ( const Vector2< double > &  v,
LinesPercept::LineType  type 
) const

The function returns the point on a line of a certain type closest to given a point.

Parameters:
v The reference point.
type The type of the lines.
Returns:
The point on a line.

Definition at line 551 of file Field.cpp.

References dist(), lines, and table.

Referenced by ObservationTable< 280, 200, 25 >::create(), and getClosestDistance().

double Field::getDistance ( const Pose2D pose,
bool  ignoreFieldLines = false 
) const

The function returns the distance between a point and the closest point on a line in a certain direction.

Parameters:
pose The reference point and direction.
ignoreFieldLines The field lines are ignored during the search.
Returns:
The distance. It is -1 if no line of that type exists in the certain direction.

Definition at line 653 of file Field.cpp.

References dist(), getDistance(), and LinesPercept::numberOfLineTypes.

double Field::getDistance ( const Pose2D pose,
LinesPercept::LineType  type 
) const

The function returns the distance between a point and the closest point on a line of a certain type in a certain direction.

Parameters:
pose The reference point and direction.
type The type of the lines.
Returns:
The distance. It is -1 if no line of that type exists in the certain direction.

Definition at line 632 of file Field.cpp.

References dist(), lines, and table.

Referenced by TemplateTable< 50000 >::create(), getDistance(), and getObstacleDistance().

double Field::getDistanceToBorder ( const Pose2D pose  )  const

Definition at line 690 of file Field.cpp.

References LinesPercept::border, dist(), lines, and table.

double Field::getDistanceToBoundary ( const Pose2D pose  )  const

Definition at line 710 of file Field.cpp.

References boundary, dist(), and table.

double Field::getDistanceToOwnPenaltyArea ( const Pose2D pose  )  const

The function returns the distance to the robots own penalty area for a given pose.

Parameters:
pose The reference point and direction (robot pose).
Returns:
The distance. It is -1 if no line of that type exists in the certain direction.

Definition at line 669 of file Field.cpp.

References dist(), lines, LinesPercept::numberOfLineTypes, and table.

Referenced by GT2004ObstaclesLocator::setObstaclesModel().

double Field::getObstacleDistance ( const Pose2D pose,
ObstaclesPercept::ObstacleType obstacleType 
) const

The function returns the distance between a point and the closest obstacle point in a certain direction.

Parameters:
pose The reference point and direction.
obstacleType The Obstacletype to be determined.
Returns:
The distance. It is -1 if no line of that type exists in the certain direction.

Definition at line 731 of file Field.cpp.

References LinesPercept::blueRobot, ObstaclesPercept::border, LinesPercept::border, dist(), getDistance(), ObstaclesPercept::goal, LinesPercept::numberOfLineTypes, ObstaclesPercept::opponent, LinesPercept::redRobot, LinesPercept::skyblueGoal, ObstaclesPercept::teammate, ObstaclesPercept::unknown, and LinesPercept::yellowGoal.

Referenced by Oracle::getObstaclesModel().

void Field::initBorder ( Table table  )  [private]

Definition at line 391 of file Field.cpp.

References addCoords(), table, Boundary< double >::x, and Boundary< double >::y.

Referenced by Field().

void Field::initBoundary ( Table table  )  [private]

Definition at line 40 of file Field.cpp.

References addCoords(), table, Boundary< double >::x, and Boundary< double >::y.

Referenced by Field().

void Field::initLines ( Table table,
Table xTable,
Table yTable 
) [private]

Definition at line 64 of file Field.cpp.

References addCoords(), Field::Table::index, Field::Table::numberOfEntries, pi, Field::Table::setSize(), table, Boundary< double >::x, and Boundary< double >::y.

Referenced by Field().

void Field::initOpponentGoal ( Table table  )  [private]

Definition at line 437 of file Field.cpp.

References addCoords(), table, Boundary< double >::x, and Boundary< double >::y.

Referenced by Field().

void Field::initOpponentPenaltyArea ( Table table  )  [private]

Definition at line 357 of file Field.cpp.

References addCoords(), table, Boundary< double >::x, and Boundary< double >::y.

Referenced by Field().

void Field::initOwnGoal ( Table table  )  [private]

Definition at line 458 of file Field.cpp.

References addCoords(), table, Boundary< double >::x, and Boundary< double >::y.

Referenced by Field().

void Field::initOwnPenaltyArea ( Table table  )  [private]

Definition at line 324 of file Field.cpp.

References addCoords(), table, Boundary< double >::x, and Boundary< double >::y.

Referenced by Field().

void Field::initSimpleLines ( Table table  )  [private]

Definition at line 235 of file Field.cpp.

References addCoords(), table, Boundary< double >::x, and Boundary< double >::y.

Referenced by Field().

bool Field::isReallyInside ( const Vector2< double > &  v  )  const

The function checks whether a point is inside the field.

Parameters:
v The point.
Returns:
Is the point inside?

Definition at line 509 of file Field.cpp.

References boundary, Field::Table::corner, Boundary< double >::isInside(), Field::Table::length, and Field::Table::numberOfEntries.

Referenced by clip(), and randomPose().

void Field::placePlayers ( const PlayerPoseCollection ppc  ) 

The function places all robots as obstacles in an internal data structure.

Parameters:
ppc The poses of all other players on the field.

Definition at line 764 of file Field.cpp.

References addPlayer(), PlayerPoseCollection::getOpponentPlayerPose(), PlayerPoseCollection::getOwnPlayerPose(), PlayerPose::getPose(), lines, LinesPercept::numberOfLineTypes, PlayerPoseCollection::numberOfOpponentPlayers, PlayerPoseCollection::numberOfOwnPlayers, and Field::Table::setSize().

Referenced by Oracle::getObstaclesModel().

Pose2D Field::randomPose (  )  const

The function returns a random pose inside the field.

Returns:
The random pose.

Definition at line 790 of file Field.cpp.

References isReallyInside(), pi, Pose2D::random(), Pose2D::translation, Boundary< double >::x, and Boundary< double >::y.

Referenced by TemplateTable< 50000 >::create(), GT2004SelfLocator::getTemplate(), and GT2004SelfLocator::GT2004SelfLocator().


Member Data Documentation

Table Field::boundary [private]

Definition at line 81 of file Field.h.

Referenced by clip(), Field(), getDistanceToBoundary(), and isReallyInside().

Table Field::lines[LinesPercept::numberOfLineTypes+6] [private]

Definition at line 81 of file Field.h.

Referenced by addPlayer(), draw(), Field(), getClosestPoint(), getDistance(), getDistanceToBorder(), getDistanceToOwnPenaltyArea(), and placePlayers().


The documentation for this class was generated from the following files:
Generated on Thu Dec 7 01:31:31 2006 for DT2005.panorama by  doxygen 1.4.7