#include <BresenhamLineScan.h>
Public Member Functions | |
BresenhamLineScan (const Vector2< int > &start, const Vector2< int > &end) | |
BresenhamLineScan (const Vector2< double > &direction, const CameraInfo &cameraInfo) | |
BresenhamLineScan (const double &direction, const CameraInfo &cameraInfo) | |
BresenhamLineScan (const Vector2< int > &start, const double &direction, const CameraInfo &cameraInfo) | |
void | init () |
void | getNext (Vector2< int > &pos) |
Public Attributes | |
int | numberOfPixels |
Private Member Functions | |
void | setup (const Vector2< int > &start, const Vector2< int > &end) |
Private Attributes | |
bool | alongX |
int | delta |
int | baseError |
int | resetError |
Vector2< int > | standardOffset |
Vector2< int > | correctionOffset |
int | error |
Definition at line 20 of file BresenhamLineScan.h.
Constructor: Computes parameters for a line
start | The start point of the line | |
end | The end point of the line |
Definition at line 45 of file BresenhamLineScan.cpp.
References setup().
BresenhamLineScan::BresenhamLineScan | ( | const Vector2< double > & | direction, | |
const CameraInfo & | cameraInfo | |||
) |
Constructor: Computes parameters for a line
direction | The direction vector of the line | |
cameraInfo | Contains image related parameters |
Definition at line 81 of file BresenhamLineScan.cpp.
References Geometry::getIntersectionPointsOfLineAndRectangle(), CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, and setup().
BresenhamLineScan::BresenhamLineScan | ( | const double & | direction, | |
const CameraInfo & | cameraInfo | |||
) |
Constructor: Computes parameters for a line
direction | The direction (angle) of the line, expressed in radians | |
cameraInfo | Contains image related parameters |
Definition at line 50 of file BresenhamLineScan.cpp.
References Geometry::getIntersectionPointsOfLineAndRectangle(), CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, and setup().
BresenhamLineScan::BresenhamLineScan | ( | const Vector2< int > & | start, | |
const double & | direction, | |||
const CameraInfo & | cameraInfo | |||
) |
Constructor: Computes parameters for a line, numberOfPixels can be used as a termination condition to prevent scans outside of the image space
start | The start point of the line | |
direction | The direction (angle) of the line, expressed in radians | |
cameraInfo | Contains image related parameters |
Definition at line 63 of file BresenhamLineScan.cpp.
References delta, Geometry::getIntersectionPointsOfLineAndRectangle(), CameraInfo::resolutionHeight, CameraInfo::resolutionWidth, and setup().
void BresenhamLineScan::getNext | ( | Vector2< int > & | pos | ) | [inline] |
Increments the coordinates to the next point on the line.
pos | The position of the current pixel on the line, which is incremented by the Bresenham algorithm |
Definition at line 59 of file BresenhamLineScan.h.
References correctionOffset, delta, error, resetError, and standardOffset.
Referenced by GT2004BallSpecialist::addBallPercept(), ScanningGrid::prepareHorizontalScanline(), ScanningGrid::prepareVerticalScanline(), and GT2004BeaconDetector::scanForBeaconPart().
void BresenhamLineScan::init | ( | ) | [inline] |
initializes the error counter
Definition at line 50 of file BresenhamLineScan.h.
References baseError, and error.
Referenced by ScanningGrid::prepareHorizontalScanline(), ScanningGrid::prepareVerticalScanline(), GT2004BeaconDetector::scanForBeaconPart(), and GT2004BeaconDetector::scanForPink().
void BresenhamLineScan::setup | ( | const Vector2< int > & | start, | |
const Vector2< int > & | end | |||
) | [private] |
Computes the Bresenham parameters
Definition at line 13 of file BresenhamLineScan.cpp.
References abs(), alongX, baseError, correctionOffset, delta, numberOfPixels, resetError, standardOffset, Vector2< V >::x, and Vector2< V >::y.
Referenced by BresenhamLineScan().
bool BresenhamLineScan::alongX [private] |
Increase x-values, if true
Definition at line 79 of file BresenhamLineScan.h.
Referenced by setup().
int BresenhamLineScan::baseError [private] |
The initial error value
Definition at line 83 of file BresenhamLineScan.h.
Vector2<int> BresenhamLineScan::correctionOffset [private] |
The additional offset, if the error is above zero
Definition at line 89 of file BresenhamLineScan.h.
int BresenhamLineScan::delta [private] |
The error per step
Definition at line 81 of file BresenhamLineScan.h.
Referenced by BresenhamLineScan(), getNext(), and setup().
int BresenhamLineScan::error [private] |
The current error counter
Definition at line 91 of file BresenhamLineScan.h.
The numberOfPixels, can be used as a termination condition for the scan, but only if the first constructor has been used (the other 2 constructors are in fact meant for infinite/unbounded scans, so it doesn't make sense)
Definition at line 74 of file BresenhamLineScan.h.
Referenced by ScanningGrid::prepareHorizontalScanline(), ScanningGrid::prepareVerticalScanline(), GT2004BeaconDetector::scanForBeaconPart(), GT2004BeaconDetector::scanForPink(), and setup().
int BresenhamLineScan::resetError [private] |
Resets the error to a value less than zero
Definition at line 85 of file BresenhamLineScan.h.
Vector2<int> BresenhamLineScan::standardOffset [private] |
The standard offset per step
Definition at line 87 of file BresenhamLineScan.h.