Implements an iterator that is able to iterate over a Bresenham line point by point using the prefix ++operator and –operator.
More...
#include <geometry/Bresenham.h>
Implements an iterator that is able to iterate over a Bresenham line point by point using the prefix ++operator and –operator.
This class is generic and operates on the point coordinates only without underlying data. It can be subclassed to implement a more specialized iterator that is able to iterate over concrete data structures like images etc. Such a subclassed iterator can be extended by a *operator and ->operator to allow direct access to the data for drawing and sampling lines e.g.
- See also
- Geometry
◆ BresenhamLineIterator()
Creates a new bresenham iterator that iterates over a line starting at coordinate (x0,y0) and ending in (x1,y1).
- Parameters
-
[in] | x0 | the x start coordinate |
[in] | y0 | the y start coordinate |
[in] | x1 | the x end coordinate |
[in] | y1 | the y end coordinate |
[in] | xInc | the optional increment in x-direction (default = 1) |
[in] | yInc | the optional increment in y-direction (default = 1) |
◆ hasNext()
Returns true, if there are more points/pixels to go.
◆ operator++()
Advances the iterator to the next point/pixel.
◆ operator--()
Moves iterator backward to the previous point/pixel.
◆ x()
Returns current x-coordinate.
◆ y()
Returns current y-coordinate.
◆ isMajorX()
Returns true if the line mainly moves along the x-axis.
◆ isMajorY()
Returns true if the line mainly moves along the y-axis.
◆ pos()
Returns the current position on the line.
◆ length()
Returns the length of the line in points/pixels.
◆ orthogonal()
Creates a new bresenham line iterator that is orthogonal to this line and starts in the current point.
The documentation for this class was generated from the following file: