This class implements bresenham line algorithms.
More...
|
static bool | borderIntersection (const Line2 &line, const int leftBorder, const int topBorder, const int rightBorder, const int bottomBorder, int &x0, int &y0, int &x1, int &y1) |
| Computes the pixel-precise border intersection (the begin and end position) of a sub-pixel-precise 2D line which needs be is visible within a specified pixel-precise frame only. More...
|
|
static bool | borderIntersection (const Line2 &line, const Scalar leftBorder, const Scalar topBorder, const Scalar rightBorder, const Scalar bottomBorder, Scalar &x0, Scalar &y0, Scalar &x1, Scalar &y1) |
| Computes the sub-pixel-precise border intersection (the begin and end position) of a sub-pixel-precise 2D line which needs be is visible within a specified pixel-precise frame only. More...
|
|
static unsigned int | numberLinePixels (const int x0, const int y0, const int x1, const int y1) |
| Determines the number of pixels necessary for a line between two given points. More...
|
|
static void | intermediatePixels (const PixelPosition &position0, const PixelPosition &position1, PixelPositions &pixels) |
| Determines the intermediate pixels between two given pixels. More...
|
|
This class implements bresenham line algorithms.
◆ Orientation
Definition of different line orientations.
Enumerator |
---|
ORIENTATION_INVALID | Invalid orientation.
|
ORIENTATION_0 | Line orientation with range [0, 45] degree.
|
ORIENTATION_1 | Line orientation with range (45, 90] degree.
|
ORIENTATION_2 | Line orientation with range [90, 135) degree.
|
ORIENTATION_3 | Line orientation with range [135, 180] degree.
|
ORIENTATION_4 | Line orientation with range [180, 225] degree.
|
ORIENTATION_5 | Line orientation with range (225, 270] degree.
|
ORIENTATION_6 | Line orientation with range (270, 315] degree.
|
ORIENTATION_7 | Line orientation with range (315, 360] degree.
|
◆ Bresenham() [1/2]
Ocean::CV::Bresenham::Bresenham |
( |
| ) |
|
|
inline |
Creates an invalid object.
◆ Bresenham() [2/2]
Ocean::CV::Bresenham::Bresenham |
( |
const int |
x0, |
|
|
const int |
y0, |
|
|
const int |
x1, |
|
|
const int |
y1 |
|
) |
| |
Creates a new Bresenham line.
- Parameters
-
x0 | Horizontal start position of the line, with range (-infinity, infinity) |
y0 | Vertical start position of the line, with range (-infinity, infinity) |
x1 | Horizontal stop position of the line (inclusive), with range (-infinity, infinity) |
y1 | Vertical stop position of the line (inclusive), with range (-infinity, infinity) |
◆ borderIntersection() [1/2]
static bool Ocean::CV::Bresenham::borderIntersection |
( |
const Line2 & |
line, |
|
|
const int |
leftBorder, |
|
|
const int |
topBorder, |
|
|
const int |
rightBorder, |
|
|
const int |
bottomBorder, |
|
|
int & |
x0, |
|
|
int & |
y0, |
|
|
int & |
x1, |
|
|
int & |
y1 |
|
) |
| |
|
static |
Computes the pixel-precise border intersection (the begin and end position) of a sub-pixel-precise 2D line which needs be is visible within a specified pixel-precise frame only.
The begin position will be at the left border, otherwise at the top border or bottom border (in this order).
- Parameters
-
line | The 2D line for which the begin position and end position will be determined, must be valid |
leftBorder | Left inclusive pixel border (e.g. could be 0), with range (-infinity, infinity) |
topBorder | Top inclusive pixel border (e.g. could be 0), with range (-infinity, infinity) |
rightBorder | Right inclusive pixel border (e.g. could be width - 1), with range [leftBorder, infinity) |
bottomBorder | Bottom inclusive pixel border (e.g. could be height - 1), with range [topBorder, infinity) |
x0 | Resulting horizontal begin position in pixel, with range [leftBorder, rightBorder] |
y0 | Resulting vertical begin position in pixel, with range [topBorder, bottomBorder] |
x1 | Resulting horizontal end position in pixel, with range [leftBorder, rightBorder] |
y1 | Resulting vertical end position in pixel, with range [topBorder, bottomBorder] |
- Returns
- True, if the given line lies inside the defined frame
◆ borderIntersection() [2/2]
Computes the sub-pixel-precise border intersection (the begin and end position) of a sub-pixel-precise 2D line which needs be is visible within a specified pixel-precise frame only.
The begin position will be at the left border, otherwise at the top border or bottom border (in this order).
- Parameters
-
line | The 2D line for which the begin position and end position will be determined, must be valid |
leftBorder | Left inclusive pixel border (e.g. could be 0), with range (-infinity, infinity) |
topBorder | Top inclusive pixel border (e.g. could be 0), with range (-infinity, infinity) |
rightBorder | Right inclusive pixel border (e.g. could be width - 1), with range [leftBorder, infinity) |
bottomBorder | Bottom inclusive pixel border (e.g. could be height - 1), with range [topBorder, infinity) |
x0 | Resulting horizontal begin position in pixel, with range [leftBorder, rightBorder] |
y0 | Resulting vertical begin position in pixel, with range [topBorder, bottomBorder] |
x1 | Resulting horizontal end position in pixel, with range [leftBorder, rightBorder] |
y1 | Resulting vertical end position in pixel, with range [topBorder, bottomBorder] |
- Returns
- True, if the given line lies inside the defined frame
◆ findNext()
void Ocean::CV::Bresenham::findNext |
( |
int & |
x, |
|
|
int & |
y |
|
) |
| |
Applies one Bresenham step to find the next pixel.
- Parameters
-
x | Current horizontal position which will be updated, with range (-infinity, infinity) |
y | Current vertical position which will be updated, with range (-infinity, infinity) |
◆ intermediatePixels()
Determines the intermediate pixels between two given pixels.
- Parameters
-
position0 | Begin position of the line (excluding), with range (-infinity, infinity)x(-infinity, infinity) |
position1 | End position of the line (excluding), with range (-infinity, infinity)x(-infinity, infinity) |
pixels | The resulting intermediate pixels |
◆ isValid()
bool Ocean::CV::Bresenham::isValid |
( |
| ) |
const |
|
inline |
Returns whether this object holds a valid line.
- Returns
- True, if so
◆ numberLinePixels()
static unsigned int Ocean::CV::Bresenham::numberLinePixels |
( |
const int |
x0, |
|
|
const int |
y0, |
|
|
const int |
x1, |
|
|
const int |
y1 |
|
) |
| |
|
static |
Determines the number of pixels necessary for a line between two given points.
The number of pixels include the begin and end points.
- Parameters
-
x0 | Horizontal begin position of the line, with range (-infinity, infinity) |
y0 | Vertical begin position of the line, with range (-infinity, infinity) |
x1 | Horizontal end position of the line, with range (-infinity, infinity) |
y1 | Vertical end position of the line, with range (-infinity, infinity) |
- Returns
- Number of line pixels, with range [1, infinity)
◆ orientation()
Returns the current orientation of the bresenham line.
- Returns
- The current orientation
◆ control_
int Ocean::CV::Bresenham::control_ |
|
protected |
◆ orientation_
◆ updateX_
int Ocean::CV::Bresenham::updateX_ |
|
protected |
◆ updateXY_
int Ocean::CV::Bresenham::updateXY_ |
|
protected |
Horizontal and vertical update value.
The documentation for this class was generated from the following file: