38 #include "organized_index_iterator.h"
178 int x_dir = ((delta_x > 0) ? 1 : -1);
179 int y_dir = ((delta_y > 0) ? 1 : -1);
184 if (delta_x >= delta_y) {
Organized Index Iterator for iterating over the "pixels" for a given line using the Bresenham algorit...
unsigned x_end_
column index of end pixel/point
void operator++() override
go to next pixel/point in image/cloud
int y_minus_
increment of row index in case of just an y-step (if dx > dy)
unsigned getColumnIndex() const override
returns the col index (x-coordinate) of the current pixel/point
int index_minus_
increment pixel/point index in case of just an y-step (if dx > dy)
unsigned y_
current row index
void reset() override
resets the iterator to the beginning of the line
int x_minus_
increment of column index in case of just an y-step (if dx > dy)
unsigned getRowIndex() const override
returns the row index (y-coordinate) of the current pixel/point
unsigned y_end_
row index of end pixel/point
LineIterator(unsigned x_start, unsigned y_start, unsigned x_end, unsigned y_end, unsigned width, const Neighborhood &neighborhood=Neighbor8)
Constructor.
int error_minus_
increment of error (distance) value in case of an y-step (if dx > dy)
int error_plus_
increment of error (distance) value in case of just an x-step (if dx > dy)
~LineIterator() override
Destructor.
void init(const Neighborhood &neighborhood)
initializes the variables for the Bresenham algorithm
Neighborhood
Neighborhood connectivity
int y_plus_
increment of row index in case of just an x-step (if dx > dy)
int index_plus_
increment pixel/point index in case of just an x-step (if dx > dy)
int x_plus_
increment of column index in case of just an x-step (if dx > dy)
unsigned x_
current column index
unsigned y_start_
row index of first pixel/point
int error_max_
error threshold
int error_
current distance to the line
unsigned x_start_
column index of first pixel/point
bool isValid() const override
return whether the current visited pixel/point is valid or not.
base class for iterators on 2-dimensional maps like images/organized clouds etc.
unsigned width_
the width of the image/cloud
unsigned index_
the index of the current pixel/point