Geometry Class Reference

#include <Geometry.h>

List of all members.

Static Public Member Functions

static double angleTo (const Pose2D &from, const Vector2< double > &to)
static double distanceTo (const Pose2D &from, const Vector2< double > &to)
static Vector2< double > vectorTo (const Pose2D &from, const Vector2< double > &to)
static Circle getCircle (const Vector2< int > point1, const Vector2< int > point2, const Vector2< int > point3)
static bool getIntersectionOfLines (const Line line1, const Line line2, Vector2< double > &intersection)
static bool getIntersectionOfLines (const Line line1, const Line line2, Vector2< int > &intersection)
static bool getIntersectionOfRaysFactor (const Line ray1, const Line ray2, double &intersection)
static double getDistanceToLine (const Line line, const Vector2< double > &point)
static double getDistanceToEdge (const Line line, const Vector2< double > &point)
static double distance (const Vector2< double > &point1, const Vector2< double > &point2)
static double distance (const Vector2< int > &point1, const Vector2< int > &point2)
static Vector3< double > rayFromCamera (int y, const CameraMatrix &cameraMatrix, const CameraMatrix &prevCameraMatrix, const Vector3< double > vector, const CameraInfo &cameraInfo)
static void calculateAnglesForPoint (const Vector2< int > &point, const CameraMatrix &cameraMatrix, const CameraInfo &cameraInfo, Vector2< double > &angles)
static void calculateAnglesForPoint (const Vector2< int > &point, const CameraMatrix &cameraMatrix, const CameraMatrix &prevCameraMatrix, const CameraInfo &cameraInfo, Vector2< double > &angles)
static void calculatePointByAngles (const Vector2< double > &angles, const CameraMatrix &cameraMatrix, const CameraInfo &cameraInfo, Vector2< int > &point)
static bool clipLineWithQuadrangle (const Line lineToClip, const Vector2< double > &corner0, const Vector2< double > &corner1, const Vector2< double > &corner2, const Vector2< double > &corner3, Vector2< double > &clipPoint1, Vector2< double > &clipPoint2)
static bool clipLineWithQuadrangle (const Line lineToClip, const Vector2< double > &corner0, const Vector2< double > &corner1, const Vector2< double > &corner2, const Vector2< double > &corner3, Vector2< int > &clipPoint1, Vector2< int > &clipPoint2)
static bool isPointInsideRectangle (const Vector2< double > &bottomLeftCorner, const Vector2< double > &topRightCorner, const Vector2< double > &point)
static bool isPointInsideRectangle (const Vector2< int > &bottomLeftCorner, const Vector2< int > &topRightCorner, const Vector2< int > &point)
static bool clipPointInsideRectange (const Vector2< int > &bottomLeftCorner, const Vector2< int > &topRightCorner, Vector2< int > &point)
static bool calculatePointOnField (const int x, const int y, const CameraMatrix &cameraMatrix, const CameraInfo &cameraInfo, Vector2< int > &pointOnField)
static bool calculatePointOnField (const int x, const int y, const CameraMatrix &cameraMatrix, const CameraMatrix &prevCameraMatrix, const CameraInfo &cameraInfo, Vector2< int > &pointOnField)
static void calculatePointInImage (const Vector2< int > &point, const CameraMatrix &cameraMatrix, const CameraInfo &cameraInfo, Vector2< int > &pointInImage)
static void calculatePointInImage (const Vector3< int > &point, const CameraMatrix &cameraMatrix, const CameraInfo &cameraInfo, Vector2< int > &pointInImage)
static bool getIntersectionPointsOfLineAndRectangle (const Vector2< int > &bottomLeft, const Vector2< int > &topRight, const Geometry::Line line, Vector2< int > &point1, Vector2< int > &point2)
static bool clipLineWithRectangleCohenSutherland (const Vector2< int > &bottomLeft, const Vector2< int > &topRight, Vector2< int > &point1, Vector2< int > &point2)
static int cohenSutherlandOutCode (const Vector2< int > &bottomLeft, const Vector2< int > &topRight, Vector2< int > &point)
static int intersection (int a1, int b1, int a2, int b2, int value)
static Vector2< double > relative2FieldCoord (RobotPose rp, double x, double y)
static Vector2< double > fieldCoord2Relative (RobotPose robotPose, Vector2< double > fieldCoord)
static bool calculateBallInImage (const Vector2< double > &ballOffset, const CameraMatrix &cameraMatrix, const CameraInfo &cameraInfo, Circle &circle)
static double getDistanceBySize (const CameraInfo &cameraInfo, double sizeInReality, double sizeInPixels)
static double getDistanceBySize (const CameraInfo &cameraInfo, double sizeInReality, double sizeInPixels, int centerX, int centerY)
static double getDistanceByAngleSize (double sizeInReality, double sizeInPixels)
static double getBallDistanceByAngleSize (double sizeInReality, double sizeInPixels)
static double getSizeByDistance (double sizeInReality, double distance, double imageWidthPixels, double imageWidthAngle)
static double getSizeByDistance (const CameraInfo &cameraInfo, double sizeInReality, double distance)
static Geometry::Line calculateHorizon (const CameraMatrix &cameraMatrix, const CameraInfo &cameraInfo)
static int calculateLineSize (const Vector2< int > &pointInImage, const CameraMatrix &cameraMatrix, const CameraInfo &cameraInfo)
static double pixelSizeToAngleSize (double pixelSize, const CameraInfo &cameraInfo)
static double angleSizeToPixelSize (double angleSize, const CameraInfo &cameraInfo)
static void radialDistortionCorrection (const CameraInfo &cameraInfo, const int srcX, const int srcY, double &correctedX, double &correctedY)
static void setupRadialCorrection (const CameraInfo &cameraInfo)
static void setupRadialCorrectionERS7 ()
static void setupRadialCorrectionERS210 ()
static bool insideCircle (Geometry::Circle &circle, double radius2, double x, double y)
static void radialDistortionCorrectionFast (const int srcX, const int srcY, int &correctedX, int &correctedY)

Static Private Member Functions

static double calculateScaleFactor (int y, unsigned long frameNumber, unsigned long prevFrameNumber, const CameraInfo &cameraInfo)

Static Private Attributes

static CorrectedCoords radialCorrectionLUT [cameraResolutionHeight_ERS7][cameraResolutionWidth_ERS7]

Classes

struct  Circle
struct  CorrectedCoords
struct  Line
struct  PixeledLine
class  SetOfPoints


Detailed Description

The class Geometry defines representations for geometric objects and Methods for calculations with such object.

Definition at line 33 of file Geometry.h.


Member Function Documentation

double Geometry::angleSizeToPixelSize ( double  angleSize,
const CameraInfo cameraInfo 
) [static]

Calculates the pixel size for a given angle size.

Definition at line 905 of file Geometry.cpp.

References CameraInfo::focalLength.

Referenced by DrawingMethods::paintBallPerceptForImageView().

double Geometry::angleTo ( const Pose2D from,
const Vector2< double > &  to 
) [static]

Calculates the angle between a pose and a position

Parameters:
from The base pose.
to The other position.
Returns:
the angle from the pose to the position.

Definition at line 25 of file Geometry.cpp.

References Pose2D::translation, Vector2< V >::x, and Vector2< V >::y.

Referenced by GT2004ObstaclesLocator::addPSDPercept(), MathFunctions::angleTo(), AngleSymbols::calculateCombinedAngles(), AngleSymbols::calculateLocalisationBasedAngles(), GT2004ObstaclesLocator::determineNextFreeTeammate(), GT2004StrategySymbols::estimateTimeToReachBall(), GT2004BasicBehaviorDirectedScanForLandmarks::execute(), GT2004BasicBehaviorGoToPoint::execute(), GT2004BasicBehaviorGoToPointAndAvoidObstacles::execute(), GT2004BasicBehaviorGoForwardToPoint::execute(), GT2004BasicBehaviorTurnAroundPoint::execute(), GT2004BasicBehaviorGoaliePositionReturn::execute(), GT2004BasicBehaviorGoaliePosition::execute(), GT2004BasicBehaviorGoToBallWithoutTurning::execute(), GT2004BasicBehaviorGoToBall::execute(), GT2004BasicBehaviorEvolveOmniParameters::execute(), fieldCoord2Relative(), BallSymbols::getAngleToOpponentGoal(), GT2004StrategySymbols::getAngleToTeammate(), KickLogger::getBallX(), KickLogger::getBallY(), BallSymbols::getKnownAngle(), BallSymbols::getSeenAngle(), BallSymbols::getSeenDistanceX(), BallSymbols::getSeenDistanceY(), CValueHistoryDlgBar::handleMessage(), PaintMethodsWin32::paintBallModelToCDC(), KickSelectionSymbols::retrieveKick(), GT2004BallLocator::setBallStateV2(), and ObstaclesSymbols::update().

void Geometry::calculateAnglesForPoint ( const Vector2< int > &  point,
const CameraMatrix cameraMatrix,
const CameraMatrix prevCameraMatrix,
const CameraInfo cameraInfo,
Vector2< double > &  angles 
) [static]

Definition at line 319 of file Geometry.cpp.

References CameraMatrix::frameNumber, CameraInfo::simulated, and Vector2< V >::y.

void Geometry::calculateAnglesForPoint ( const Vector2< int > &  point,
const CameraMatrix cameraMatrix,
const CameraInfo cameraInfo,
Vector2< double > &  angles 
) [static]

Definition at line 291 of file Geometry.cpp.

References CameraInfo::focalLength, CameraInfo::opticalCenter, Pose3D::rotation, sqr, Vector3< V >::x, Vector2< V >::x, Vector3< V >::y, Vector2< V >::y, and Vector3< V >::z.

Referenced by RBallSpecialist2::addBallPercept(), GT2004BallSpecialist::addBallPercept(), GoalRecognizer::calculateVerticalGoalScanLines(), GT2004GoalRecognizer::calculateVerticalGoalScanLines(), BoxSpecialist::detectFreePartOfGoal(), GoalRecognizer::ColoredPartsCheck::determineLargePart(), GT2004GoalRecognizer::ColoredPartsCheck::determineLargePart(), DrawingMethods::paintFreePartOfGoalModelForImageView(), DrawingMethods::paintObstaclesModelForImageView(), ScanningGrid::prepareHorizontalScanline(), ScanningGrid::prepareImageInfo(), GoalRecognizer::scanLinesForGoals(), and GT2004GoalRecognizer::scanLinesForGoals().

bool Geometry::calculateBallInImage ( const Vector2< double > &  ballOffset,
const CameraMatrix cameraMatrix,
const CameraInfo cameraInfo,
Circle circle 
) [static]

The function approximates the shape of a ball in the camera image. Note: currently, the approximation is not exact.

Parameters:
ballOffset The ball's position relative to the robot's body origin.
cameraMatrix The position and orientation of the robot's camera.
cameraInfo The resolution and the opening angle of the robot's camera.
circle The approximated shape generated by the function.
Returns:
If false, only the center of the circle is valid, not the radius.

Definition at line 875 of file Geometry.cpp.

References abs(), Vector2< V >::abs(), calculatePointByAngles(), Geometry::Circle::center, distance(), pi_2, Geometry::Circle::radius, sqr, Pose3D::translation, Vector3< V >::x, Vector2< V >::x, Vector3< V >::y, Vector2< V >::y, and Vector3< V >::z.

Geometry::Line Geometry::calculateHorizon ( const CameraMatrix cameraMatrix,
const CameraInfo cameraInfo 
) [static]

The function calculates the horizon.

Parameters:
cameraMatrix The camera matrix.
cameraInfo Object containing camera parameters.
Returns:
The line of the horizon in the image.

Definition at line 989 of file Geometry.cpp.

References Geometry::Line::base, Matrix3x3< V >::c, Geometry::Line::direction, CameraInfo::focalLength, Geometry::Line::normalizeDirection(), CameraInfo::opticalCenter, CameraInfo::resolutionWidth, Pose3D::rotation, Vector2< V >::x, Vector2< V >::y, and Vector3< V >::z.

Referenced by GT2004ImageProcessor::execute(), GT2004GoalRecognizer::execute(), GoalRecognizer::getGoalPercept(), RasterImageProcessor::init(), PanoramaImageProcessor::initialize(), and ScanningGrid::prepareImageInfo().

int Geometry::calculateLineSize ( const Vector2< int > &  pointInImage,
const CameraMatrix cameraMatrix,
const CameraInfo cameraInfo 
) [static]

The function calculates the expected size (pixel) of a field line in an image.

Parameters:
pointInImage The point where the line is expected.
cameraMatrix The camera matrix.
cameraInfo Object containing the camera parameters.
Returns:
The size of a line pixel.

Definition at line 1031 of file Geometry.cpp.

References Vector2< V >::abs(), calculatePointOnField(), getSizeByDistance(), int(), sqr, Pose3D::translation, Vector2< V >::x, Vector2< V >::y, and Vector3< V >::z.

Referenced by GT2004EdgeSpecialist::getEdgesPercept(), and GT2004ImageProcessor::scan().

void Geometry::calculatePointByAngles ( const Vector2< double > &  angles,
const CameraMatrix cameraMatrix,
const CameraInfo cameraInfo,
Vector2< int > &  point 
) [static]

Definition at line 338 of file Geometry.cpp.

References CameraInfo::focalLength, int(), RotationMatrix::invert(), CameraInfo::opticalCenter, Pose3D::rotation, Vector2< V >::x, Vector3< V >::x, Vector2< V >::y, Vector3< V >::y, and Vector3< V >::z.

Referenced by calculateBallInImage(), GoalRecognizer::calculateVerticalGoalScanLines(), GT2004GoalRecognizer::calculateVerticalGoalScanLines(), DrawingMethods::paintAngleBoundaryToImage(), DrawingMethods::paintBallPerceptForImageView(), DrawingMethods::paintLandmarksPerceptForImageView(), ScanningGrid::prepareImageInfo(), GoalRecognizer::scanHorizontalForGoals(), GT2004GoalRecognizer::scanHorizontalForGoals(), GoalRecognizer::scanLinesForGoals(), and GT2004GoalRecognizer::scanLinesForGoals().

void Geometry::calculatePointInImage ( const Vector3< int > &  point,
const CameraMatrix cameraMatrix,
const CameraInfo cameraInfo,
Vector2< int > &  pointInImage 
) [static]

Definition at line 650 of file Geometry.cpp.

References Vector2< V >::abs(), Pose3D::translation, Vector3< V >::x, Vector2< V >::x, Vector3< V >::y, Vector2< V >::y, and Vector3< V >::z.

void Geometry::calculatePointInImage ( const Vector2< int > &  point,
const CameraMatrix cameraMatrix,
const CameraInfo cameraInfo,
Vector2< int > &  pointInImage 
) [static]

Calculates where a relative point on the ground appears in an image.

Parameters:
point The coordinates of the point relative to the robot's origin.
cameraMatrix The camera matrix of the image.
cameraInfo The camera info of the image.
pointInImage The resulting point.

Definition at line 632 of file Geometry.cpp.

References Vector2< V >::abs(), Pose3D::translation, Vector3< V >::x, Vector2< V >::x, Vector3< V >::y, Vector2< V >::y, and Vector3< V >::z.

Referenced by LandmarkPercept::checkVisibility(), GT2004SelfLocator::draw(), DrawingMethods::paintEdgesPerceptForImageView(), DrawingMethods::paintFreePartOfGoalModelForImageView(), DrawingMethods::paintFreePartOfGoalPerceptForImageView(), DrawingMethods::paintLinesPerceptForImageView(), DrawingMethods::paintObstaclesModelForImageView(), and DrawingMethods::paintObstaclesPerceptForImageView().

bool Geometry::calculatePointOnField ( const int  x,
const int  y,
const CameraMatrix cameraMatrix,
const CameraMatrix prevCameraMatrix,
const CameraInfo cameraInfo,
Vector2< int > &  pointOnField 
) [static]

Calculates where a pixel in the image lies on the ground (relative to the robot).

Parameters:
x Specifies the x-coordinate of the pixel.
y Specifies the y-coordinate of the pixel.
cameraMatrix The camera matrix of the image.
prevCameraMatrix The camera matrix of the previous image.
cameraInfo The camera info of the image.
pointOnField The resulting point.

Definition at line 603 of file Geometry.cpp.

References CameraMatrix::frameNumber, int(), CameraInfo::simulated, Vector2< V >::x, and Vector2< V >::y.

bool Geometry::calculatePointOnField ( const int  x,
const int  y,
const CameraMatrix cameraMatrix,
const CameraInfo cameraInfo,
Vector2< int > &  pointOnField 
) [static]

Calculates where a pixel in the image lies on the ground (relative to the robot).

Parameters:
x Specifies the x-coordinate of the pixel.
y Specifies the y-coordinate of the pixel.
cameraMatrix The camera matrix of the image.
cameraInfo The camera info of the image.
pointOnField The resulting point.

Definition at line 566 of file Geometry.cpp.

References abs(), CameraInfo::focalLengthInv, int(), CameraInfo::opticalCenter, Pose3D::rotation, Pose3D::translation, Vector3< V >::x, Vector2< V >::x, Vector3< V >::y, Vector2< V >::y, and Vector3< V >::z.

Referenced by RBallSpecialist2::addBallPercept(), RasterImageProcessor::addFieldPoint(), RasterImageProcessor::addObstaclePoints(), GT2004ImageProcessor::calcEdgeAngle(), REnemySpecialist::calculateFarestPoint(), REnemySpecialist::calculateFarestPointCOG(), REnemySpecialist::calculateFarestPointFastCOG(), calculateLineSize(), REnemySpecialist::calculatePointOnFieldFromSegment(), GT2004EdgeSpecialist::checkPoint(), RFieldSpecialist::checkRamp(), GT2004ImageProcessor::clusterRobots(), PaintMethodsWin32::paintImageProjectionOnGroundToCDC(), OpenGLMethods::paintRotatedImageToOpenGLList(), and GT2004ImageProcessor::scan().

double Geometry::calculateScaleFactor ( int  y,
unsigned long  frameNumber,
unsigned long  prevFrameNumber,
const CameraInfo cameraInfo 
) [static, private]

Definition at line 254 of file Geometry.cpp.

References getRobotConfiguration(), RobotConfiguration::getRobotDimensions(), RobotDimensions::imagesPerSecond, RobotDimensions::motionCycleTime, and CameraInfo::resolutionHeight.

Referenced by rayFromCamera().

bool Geometry::clipLineWithQuadrangle ( const Line  lineToClip,
const Vector2< double > &  corner0,
const Vector2< double > &  corner1,
const Vector2< double > &  corner2,
const Vector2< double > &  corner3,
Vector2< int > &  clipPoint1,
Vector2< int > &  clipPoint2 
) [static]

Definition at line 363 of file Geometry.cpp.

References int(), Vector2< V >::x, and Vector2< V >::y.

bool Geometry::clipLineWithQuadrangle ( const Line  lineToClip,
const Vector2< double > &  corner0,
const Vector2< double > &  corner1,
const Vector2< double > &  corner2,
const Vector2< double > &  corner3,
Vector2< double > &  clipPoint1,
Vector2< double > &  clipPoint2 
) [static]

Definition at line 386 of file Geometry.cpp.

References Geometry::Line::base, Geometry::Line::direction, getIntersectionOfLines(), Vector2< V >::x, and Vector2< V >::y.

bool Geometry::clipLineWithRectangleCohenSutherland ( const Vector2< int > &  bottomLeft,
const Vector2< int > &  topRight,
Vector2< int > &  point1,
Vector2< int > &  point2 
) [static]

Clips a line with the Cohen-Sutherland-Algorithm

Parameters:
bottomLeft The bottom left corner of the rectangle
topRight The top right corner of the rectangle
point1 The starting point of the line
point2 The end point of the line
Returns:
states whether clipping was necessary (and done)

Definition at line 768 of file Geometry.cpp.

References Vector2< V >::x, and Vector2< V >::y.

Referenced by GoalRecognizer::calculateVerticalGoalScanLines(), GT2004GoalRecognizer::calculateVerticalGoalScanLines(), FieldDimensions::clipLineWithField(), FieldDimensions::clipLineWithFieldAndGoalAreas(), REdgeDetection::findStart(), TestDataGenerator::generateImageWithLine(), CheckerboardDetector::getLineThroughPixels(), CheckerboardDetector::getMiddleAndLengthOfPerpendicular(), TestDataGenerator::lineClippingTest(), and RDefaultStrategy::postScan().

bool Geometry::clipPointInsideRectange ( const Vector2< int > &  bottomLeftCorner,
const Vector2< int > &  topRightCorner,
Vector2< int > &  point 
) [static]

Definition at line 535 of file Geometry.cpp.

References Vector2< V >::x, and Vector2< V >::y.

Referenced by GT2004BeaconDetector::analyzeBeacon(), and GT2004BeaconDetector::scanForBeaconEdges().

static int Geometry::cohenSutherlandOutCode ( const Vector2< int > &  bottomLeft,
const Vector2< int > &  topRight,
Vector2< int > &  point 
) [inline, static]

Calculates the Cohen Sutherland Code for a given point and a given rectangle

Definition at line 489 of file Geometry.h.

References code, Vector2< V >::x, and Vector2< V >::y.

double Geometry::distance ( const Vector2< int > &  point1,
const Vector2< int > &  point2 
) [static]

Definition at line 246 of file Geometry.cpp.

double Geometry::distance ( const Vector2< double > &  point1,
const Vector2< double > &  point2 
) [static]

Definition at line 237 of file Geometry.cpp.

Referenced by calculateBallInImage(), GT2004BallSpecialist::checkIfPointsAreInsideBall(), GT2004StrategySymbols::computeRole(), fieldCoord2Relative(), RFieldSpecialist::fusionLines(), getDistanceToEdge(), getDistanceToLine(), RasterSpecialist::getDistanceToLine(), getMin(), and Geometry::Line::normalizeDirection().

double Geometry::distanceTo ( const Pose2D from,
const Vector2< double > &  to 
) [static]

Calculates the distance from a pose to a position

Parameters:
from The base pose.
to The other position.
Returns:
the distance from the pose to the position.

Definition at line 32 of file Geometry.cpp.

Referenced by MathFunctions::distanceTo(), GT2004StrategySymbols::estimateTimeToReachBall(), KickLogger::execute(), GT2004BasicBehaviorGoToPoint::execute(), GT2004BasicBehaviorGoToPointAndAvoidObstacles::execute(), GT2004BasicBehaviorTurnAroundPoint::execute(), GT2004BasicBehaviorGoaliePositionReturn::execute(), GT2004BasicBehaviorGoToBallWithoutTurning::execute(), GT2004BasicBehaviorGoToBall::execute(), GT2004BasicBehaviorEvolveOmniParameters::execute(), fieldCoord2Relative(), KickLogger::getBallX(), KickLogger::getBallY(), RobotPoseSymbols::getDistanceToOpponentGoal(), RobotPoseSymbols::getDistanceToOwnGoal(), GT2004StrategySymbols::getGoalieMaxPositionSpeed(), BallSymbols::getKnownDistance(), GT2004HeadControlSymbols::getSeenDistance(), BallSymbols::getSeenDistance(), CValueHistoryDlgBar::handleMessage(), PaintMethodsWin32::paintBallModelToCDC(), KickSelectionSymbols::retrieveKick(), GT2004BallLocator::setBallStateV2(), ObstaclesSymbols::update(), and BallSymbols::update().

Vector2< double > Geometry::fieldCoord2Relative ( RobotPose  robotPose,
Vector2< double >  fieldCoord 
) [static]

Function does the transformation from 2d field coordinates to coordinates relative to the robot.

Parameters:
robotPose current Robot Pose.
fieldCoord 
Returns:
Returns the positon in relative

Definition at line 865 of file Geometry.cpp.

References angleTo(), distance(), distanceTo(), RobotPose::getPose(), Vector2< V >::x, and Vector2< V >::y.

Referenced by GT2004StrategySymbols::computeRole(), and GT2004HeadControl::getLookAtBallAngles().

double Geometry::getBallDistanceByAngleSize ( double  sizeInReality,
double  sizeInPixels 
) [static]

The function determines how far the ball is away depending on its real size and the size in the image.

Parameters:
sizeInReality The real size of the ball.
sizeInPixels The size in the image.
Returns:
The distance between the camera and the ball.

Definition at line 955 of file Geometry.cpp.

Referenced by BallPercept::getOffsetSizeBased().

Geometry::Circle Geometry::getCircle ( const Vector2< int >  point1,
const Vector2< int >  point2,
const Vector2< int >  point3 
) [static]

Returns the circle defined by the three points.

Parameters:
point1 The first point.
point2 The second point.
point3 The third point.
Returns:
The circle defined by point1, point2 and point3.

Definition at line 52 of file Geometry.cpp.

References Geometry::Circle::center, Geometry::Circle::radius, sqr, Vector2< V >::x, and Vector2< V >::y.

Referenced by RBallSpecialist2::calculateCircleByEdges(), and RBallSpecialist2::calculateSmallCircle().

double Geometry::getDistanceByAngleSize ( double  sizeInReality,
double  sizeInPixels 
) [static]

The function determines how far an object is away depending on its real size and the size in the image.

Parameters:
sizeInReality The real size of the object.
sizeInPixels The size in the image.
Returns:
The distance between camera and object.

Definition at line 946 of file Geometry.cpp.

double Geometry::getDistanceBySize ( const CameraInfo cameraInfo,
double  sizeInReality,
double  sizeInPixels,
int  centerX,
int  centerY 
) [static]

The function determines how far an object is away depending on its real size and the size in the image along with its center position, using camera intrinsic parameters.

Parameters:
cameraInfo Class containing the intrinsic paramaters
sizeInReality The real size of the object.
sizeInPixels The size in the image.
centerX X coordinate (in image reference) of object's baricenter.
centerY Y coordinate (in image reference) of object's baricenter.
Returns:
The distance between camera and object.

Definition at line 927 of file Geometry.cpp.

References CameraInfo::focalLenPow2, CameraInfo::opticalCenter, Vector2< V >::x, and Vector2< V >::y.

double Geometry::getDistanceBySize ( const CameraInfo cameraInfo,
double  sizeInReality,
double  sizeInPixels 
) [static]

Definition at line 916 of file Geometry.cpp.

References CameraInfo::focalLength.

Referenced by RBridgeSpecialist::findBridgeMark(), BallPercept::getOffsetIntrinsic(), GoalRecognizer::scanLinesForGoals(), and GT2004GoalRecognizer::scanLinesForGoals().

double Geometry::getDistanceToEdge ( const Line  line,
const Vector2< double > &  point 
) [static]

Definition at line 215 of file Geometry.cpp.

References Geometry::Line::base, d, Geometry::Line::direction, distance(), getDistanceToLine(), Vector2< V >::x, and Vector2< V >::y.

Referenced by FieldDimensions::distanceToBorder().

double Geometry::getDistanceToLine ( const Line  line,
const Vector2< double > &  point 
) [static]

Definition at line 196 of file Geometry.cpp.

References Geometry::Line::base, Geometry::Line::direction, distance(), Vector2< V >::normalize(), Vector2< V >::x, and Vector2< V >::y.

Referenced by RBallSpecialist2::addBallPercept(), REnemySpecialist::calculateFarestPoint(), REnemySpecialist::calculateFarestPointCOG(), REnemySpecialist::calculateFarestPointFastCOG(), FieldDimensions::clipLineWithField(), FieldDimensions::distanceToBorder(), BoxSpecialist::fusionGoal(), RFieldSpecialist::fusionLines(), ObstaclesModel::getDistanceInCorridor(), getDistanceToEdge(), FieldDimensions::isInsideField(), BoxSpecialist::mergeBoxes(), GT2004FlagSpecialist::searchFlags(), BoxSpecialist::searchGoal(), FieldDimensions::vectorToBorder(), and FieldDimensions::vectorToBorderIncludingGoals().

bool Geometry::getIntersectionOfLines ( const Line  line1,
const Line  line2,
Vector2< int > &  intersection 
) [static]

Definition at line 122 of file Geometry.cpp.

References getIntersectionOfLines(), int(), intersection(), Vector2< V >::x, and Vector2< V >::y.

bool Geometry::getIntersectionOfLines ( const Line  line1,
const Line  line2,
Vector2< double > &  intersection 
) [static]

Definition at line 136 of file Geometry.cpp.

References Geometry::Line::base, Geometry::Line::direction, intersection(), Vector2< V >::x, and Vector2< V >::y.

Referenced by RFieldSpecialist::analyzeLines(), FieldDimensions::clipLineWithField(), clipLineWithQuadrangle(), RBridgeSpecialist::createBBox(), BoxSpecialist::createBBox(), getIntersectionOfLines(), BoxSpecialist::mergeBoxes(), RDefaultStrategy::postScan(), GT2004ImageProcessor::scanColumns(), and BoxSpecialist::searchGoal().

bool Geometry::getIntersectionOfRaysFactor ( const Line  ray1,
const Line  ray2,
double &  intersection 
) [static]

Definition at line 173 of file Geometry.cpp.

References Geometry::Line::base, Geometry::Line::direction, Vector2< V >::x, and Vector2< V >::y.

bool Geometry::getIntersectionPointsOfLineAndRectangle ( const Vector2< int > &  bottomLeft,
const Vector2< int > &  topRight,
const Geometry::Line  line,
Vector2< int > &  point1,
Vector2< int > &  point2 
) [static]

Clips a line with a rectangle

Parameters:
bottomLeft The bottom left corner of the rectangle
topRight The top right corner of the rectangle
line The line to be clipped
point1 The starting point of the resulting line
point2 The end point of the resulting line
Returns:
states whether clipping was necessary (and done)

Definition at line 689 of file Geometry.cpp.

References abs(), Geometry::Line::base, Geometry::Line::direction, int(), Vector2< V >::x, and Vector2< V >::y.

Referenced by BresenhamLineScan::BresenhamLineScan(), GoalRecognizer::calculateScanLinesParallelToHorizon(), GT2004GoalRecognizer::calculateScanLinesParallelToHorizon(), GT2004ImageProcessor::execute(), GT2004BeaconDetector::execute(), PanoramaImageProcessor::initialize(), TestDataGenerator::lineClippingTest2(), ScanningGrid::prepareHorizontalScanline(), ScanningGrid::prepareImageInfo(), GT2004ImageProcessor::scanColumns(), GT2004BeaconDetector::scanForBeaconEdges(), and GT2004ImageProcessor::scanRows().

double Geometry::getSizeByDistance ( const CameraInfo cameraInfo,
double  sizeInReality,
double  distance 
) [static]

The function determines how big an object appears in the image depending on its distance and size.

Parameters:
cameraInfo Object containing camera paramters.
sizeInReality The real size of the object.
distance The distance to the object.
Returns:
The size as it would appear in the image.

Definition at line 964 of file Geometry.cpp.

References CameraInfo::focalLength.

double Geometry::getSizeByDistance ( double  sizeInReality,
double  distance,
double  imageWidthPixels,
double  imageWidthAngle 
) [static]

The function determines how big an object appears in the image depending on its distance and size.

Parameters:
sizeInReality The real size of the object.
distance The distance to the object.
imageWidthPixels The horizontal resolution of the image.
imageWidthAngle The horizontal opening angle of the camera.
Returns:
The size as it would appear in the image.

Definition at line 976 of file Geometry.cpp.

Referenced by calculateLineSize(), and GT2004ImageProcessor::scan().

static bool Geometry::insideCircle ( Geometry::Circle circle,
double  radius2,
double  x,
double  y 
) [inline, static]

Definition at line 705 of file Geometry.h.

References Geometry::Circle::center, Vector2< V >::x, and Vector2< V >::y.

Referenced by RBallSpecialist2::validateCircle().

int Geometry::intersection ( int  a1,
int  b1,
int  a2,
int  b2,
int  value 
) [static]

Calculates the intersection of an arbitrary line and a horizontal or vertical line.

Definition at line 840 of file Geometry.cpp.

References int().

Referenced by getIntersectionOfLines().

bool Geometry::isPointInsideRectangle ( const Vector2< int > &  bottomLeftCorner,
const Vector2< int > &  topRightCorner,
const Vector2< int > &  point 
) [static]

Definition at line 523 of file Geometry.cpp.

References Vector2< V >::x, and Vector2< V >::y.

bool Geometry::isPointInsideRectangle ( const Vector2< double > &  bottomLeftCorner,
const Vector2< double > &  topRightCorner,
const Vector2< double > &  point 
) [static]

Definition at line 510 of file Geometry.cpp.

References Vector2< V >::x, and Vector2< V >::y.

Referenced by LandmarkPercept::checkVisibility().

double Geometry::pixelSizeToAngleSize ( double  pixelSize,
const CameraInfo cameraInfo 
) [static]

Calculates the angle size for a given pixel size.

Definition at line 910 of file Geometry.cpp.

References CameraInfo::focalLengthInv.

Referenced by RBallSpecialist2::addBallPercept(), and GT2004BallSpecialist::addBallPercept().

static void Geometry::radialDistortionCorrection ( const CameraInfo cameraInfo,
const int  srcX,
const int  srcY,
double &  correctedX,
double &  correctedY 
) [inline, static]

Corrects the radial distortion introduced by the camera lens (using a 4th order model) of a given pixel.

Parameters:
cameraInfo Class containing camera intrinsic parameters
srcX X coordinate (image reference) of pixel to be distortion-corrected.
srcY Y coordinate (image reference) of pixel to be distortion-corrected.
correctedX X coordinate (image reference) of resulting distortion-corrected pixel.
correctedY Y coordinate (image reference) of resulting distortion-corrected pixel.

Definition at line 675 of file Geometry.h.

References CameraInfo::focalLenPow2, CameraInfo::focalLenPow4, CameraInfo::fourthOrderRadialDistortion, CameraInfo::opticalCenter, CameraInfo::secondOrderRadialDistortion, Vector2< V >::x, and Vector2< V >::y.

Referenced by setupRadialCorrection().

static void Geometry::radialDistortionCorrectionFast ( const int  srcX,
const int  srcY,
int &  correctedX,
int &  correctedY 
) [inline, static]

Corrects the radial distortion introduced by the camera lens (using a 4th order model) of a given pixel, using a pre-computed look-up table.

Parameters:
srcX X coordinate (image reference) of pixel to be distortion-corrected.
srcY Y coordinate (image reference) of pixel to be distortion-corrected.
correctedX X coordinate (image reference) of resulting distortion-corrected pixel.
correctedY Y coordinate (image reference) of resulting distortion-corrected pixel.

Definition at line 718 of file Geometry.h.

References radialCorrectionLUT, Geometry::CorrectedCoords::x, and Geometry::CorrectedCoords::y.

Vector3< double > Geometry::rayFromCamera ( int  y,
const CameraMatrix cameraMatrix,
const CameraMatrix prevCameraMatrix,
const Vector3< double >  vector,
const CameraInfo cameraInfo 
) [static]

Definition at line 272 of file Geometry.cpp.

References calculateScaleFactor(), CameraMatrix::frameNumber, Pose3D::rotation, and CameraInfo::simulated.

Referenced by GT2004FlagSpecialist::getFlagPercept().

Vector2< double > Geometry::relative2FieldCoord ( RobotPose  rp,
double  x,
double  y 
) [static]

Function does the transformation from 2d relative robot coordinates to absolute field coordinates.

Parameters:
rp current Robot Pose.
x relative x-coordinate of ball (relative to robot)
y relative y-coordinate of ball (relative to robot)
Returns:
Returns the ball positon in absolute coordinates

Definition at line 850 of file Geometry.cpp.

References RotationMatrix::fromKardanRPY(), Pose2D::rotation, Pose2D::translation, Vector2< V >::x, and Vector2< V >::y.

Referenced by GT2004BallLocator::drawBallPosition(), GT2004BallLocator::execute(), GT2004BallLocator::handleSeenBall(), GT2004BallLocator::handleUnseenBall(), and KalmanConstantSpeedModel::update().

void Geometry::setupRadialCorrection ( const CameraInfo cameraInfo  )  [static]

This function builds a radial distortion correction look-up table based on the parameters contained in cameraInfo.

Parameters:
cameraInfo Object containing intrinisc (and other) camera parameters.

Definition at line 1051 of file Geometry.cpp.

References radialCorrectionLUT, radialDistortionCorrection(), CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, Geometry::CorrectedCoords::x, and Geometry::CorrectedCoords::y.

Referenced by FastPanoramaProcessor::framePrepare(), PanoramaImageProcessor::initialize(), setupRadialCorrectionERS210(), and setupRadialCorrectionERS7().

static void Geometry::setupRadialCorrectionERS210 (  )  [inline, static]

Definition at line 699 of file Geometry.h.

References RobotDesign::ERS210, and setupRadialCorrection().

static void Geometry::setupRadialCorrectionERS7 (  )  [inline, static]

Definition at line 693 of file Geometry.h.

References RobotDesign::ERS7, and setupRadialCorrection().

Vector2< double > Geometry::vectorTo ( const Pose2D from,
const Vector2< double > &  to 
) [static]

Calculates the relative vector from a pose to a position

Parameters:
from The base pose.
to The other position.
Returns:
the vector from the pose to the position.

Definition at line 38 of file Geometry.cpp.

Referenced by GT2004PotentialFieldBasicBehaviorOffensiveSupport::execute().


Member Data Documentation

Geometry::CorrectedCoords Geometry::radialCorrectionLUT [static, private]

Definition at line 726 of file Geometry.h.

Referenced by radialDistortionCorrectionFast(), and setupRadialCorrection().


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