This more general iterator basically follows the design of BresenhamLineIterator, but works on an arbitrary-dimensional line and handles real-valued start and end positions.
More...
#include <geometry/Bresenham.h>
|
struct | Axis |
| Add the type-dependent start and end value to the axis data struct. More...
|
|
|
| GeneralBresenhamLineIterator (Point< T, D > start=Point< T, D >(), Point< T, D > end=Point< T, D >()) |
| Creates a new bresenham iterator that iterates over a line starting at point start and ending in end. More...
|
|
void | init (Point< T, D > start=Point< T, D >(), Point< T, D > end=Point< T, D >()) |
| Set a new start and end, reset iterator. More...
|
|
bool | hasNext () const |
| Returns true, if there are more points/pixels to go. More...
|
|
const GeneralBresenhamLineIterator & | operator++ () |
| Advances the iterator to the next point/pixel. More...
|
|
Point< int, D > | pos () const |
| Returns the current position (in all dimensions). More...
|
|
const Axis & | axis (uint32 d) const |
| Returns axis structure for a specified dimension. More...
|
|
int | drivingAxis () const |
| Returns dimension index of the driving axis. More...
|
|
template<int D, typename T = float, int Drive = -1, int Res = 1000>
class mira::GeneralBresenhamLineIterator< D, T, Drive, Res >
This more general iterator basically follows the design of BresenhamLineIterator, but works on an arbitrary-dimensional line and handles real-valued start and end positions.
- Template Parameters
-
D | The dimension of the space the line is defined in. |
T | The numerical type of the start/end point values (default: float). |
Drive | The (dimension index of the) driving axis. The iterator hits each point/pixel between start and end on the driving axis exactly once. For a dense line, the driving axis must be the longest axis. This longest axis will be determined as the driving axis automatically if Drive is set < 0 (the default). Guaranteeing the longest axis as driving axis also enables some (compile-time) optimization for the iteration, so use with Drive=-1 is encouraged. |
Res | Resolution (default = 1000). Real-valued increments are translated to integer values (to allow for integer-arithmetic calculations) by multiplying with Res. |
for details: http://www.idav.ucdavis.edu/education/GraphicsNotes/Bresenhams-Algorithm/Bresenhams-Algorithm.html
- See also
- Geometry
◆ GeneralBresenhamLineIterator()
Creates a new bresenham iterator that iterates over a line starting at point start and ending in end.
- Parameters
-
[in] | start | the D-dimensional real-valued start point |
[in] | end | the D-dimensional real-valued end point |
◆ init()
Set a new start and end, reset iterator.
- Parameters
-
[in] | start | the D-dimensional real-valued start point |
[in] | end | the D-dimensional real-valued end point |
◆ hasNext()
Returns true, if there are more points/pixels to go.
◆ operator++()
Advances the iterator to the next point/pixel.
◆ pos()
Point< int, D > pos |
( |
| ) |
const |
|
inline |
Returns the current position (in all dimensions).
This method is just for convenience and is slow (as it creates the returned point variable from the internal axes variables). If you care about performance, query the position for each dimension using axis().
◆ axis()
const Axis& axis |
( |
uint32 |
d | ) |
const |
|
inline |
Returns axis structure for a specified dimension.
- Parameters
-
[in] | d | dimension, must be < D. |
◆ checkForDrivingAxis()
void checkForDrivingAxis |
( |
int |
index, |
|
|
const int64_t & |
dist, |
|
|
int64_t & |
maxd |
|
) |
| |
|
inlineprotectedinherited |
◆ step()
◆ drivingAxis()
int drivingAxis |
( |
| ) |
const |
|
inlineinherited |
Returns dimension index of the driving axis.
◆ mAxes
◆ mDrivingAxis
driving axis dimension index
The documentation for this class was generated from the following file: