Point Cloud Library (PCL)  1.9.1-dev
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
pcl::LineIterator Class Reference

Organized Index Iterator for iterating over the "pixels" for a given line using the Bresenham algorithm. More...

#include <pcl/geometry/line_iterator.h>

+ Inheritance diagram for pcl::LineIterator:

Public Types

enum  Neighborhood { Neighbor4 = 4, Neighbor8 = 8 }
 Neighborhood connectivity. More...
 

Public Member Functions

 LineIterator (unsigned x_start, unsigned y_start, unsigned x_end, unsigned y_end, unsigned width, const Neighborhood &neighborhood=Neighbor8)
 Constructor. More...
 
virtual ~LineIterator ()
 Destructor. More...
 
virtual void operator++ ()
 go to next pixel/point in image/cloud More...
 
virtual unsigned getRowIndex () const
 returns the row index (y-coordinate) of the current pixel/point More...
 
virtual unsigned getColumnIndex () const
 returns the col index (x-coordinate) of the current pixel/point More...
 
virtual bool isValid () const
 return whether the current visited pixel/point is valid or not. More...
 
virtual void reset ()
 resets the iterator to the beginning of the line More...
 
- Public Member Functions inherited from pcl::OrganizedIndexIterator
 OrganizedIndexIterator (unsigned width)
 constructor More...
 
virtual ~OrganizedIndexIterator ()
 virtual destructor More...
 
virtual void operator++ (int)
 go to next pixel/point in image/cloud More...
 
unsigned operator* () const
 returns the pixel/point index in the linearized memory of the image/cloud More...
 
virtual unsigned getIndex () const
 returns the pixel/point index in the linearized memory of the image/cloud More...
 

Protected Member Functions

void init (const Neighborhood &neighborhood)
 initializes the variables for the Bresenham algorithm More...
 

Protected Attributes

unsigned x_
 current column index More...
 
unsigned y_
 current row index More...
 
unsigned x_start_
 column index of first pixel/point More...
 
unsigned y_start_
 row index of first pixel/point More...
 
unsigned x_end_
 column index of end pixel/point More...
 
unsigned y_end_
 row index of end pixel/point More...
 
int error_
 current distance to the line More...
 
int error_max_
 error threshold More...
 
int error_minus_
 increment of error (distance) value in case of an y-step (if dx > dy) More...
 
int error_plus_
 increment of error (distance) value in case of just an x-step (if dx > dy) More...
 
int x_plus_
 increment of column index in case of just an x-step (if dx > dy) More...
 
int y_plus_
 increment of row index in case of just an x-step (if dx > dy) More...
 
int x_minus_
 increment of column index in case of just an y-step (if dx > dy) More...
 
int y_minus_
 increment of row index in case of just an y-step (if dx > dy) More...
 
int index_plus_
 increment pixel/point index in case of just an x-step (if dx > dy) More...
 
int index_minus_
 increment pixel/point index in case of just an y-step (if dx > dy) More...
 
- Protected Attributes inherited from pcl::OrganizedIndexIterator
unsigned width_
 the width of the image/cloud More...
 
unsigned index_
 the index of the current pixel/point More...
 

Detailed Description

Organized Index Iterator for iterating over the "pixels" for a given line using the Bresenham algorithm.

Supports 4 and 8 neighborhood connectivity

Note
iterator does not visit the given end-point (on purpose).
Author
Suat Gedikli gedik.nosp@m.li@w.nosp@m.illow.nosp@m.gara.nosp@m.ge.co.nosp@m.m

Definition at line 48 of file line_iterator.h.

Member Enumeration Documentation

Neighborhood connectivity.

Enumerator
Neighbor4 
Neighbor8 

Definition at line 52 of file line_iterator.h.

Constructor & Destructor Documentation

pcl::LineIterator::LineIterator ( unsigned  x_start,
unsigned  y_start,
unsigned  x_end,
unsigned  y_end,
unsigned  width,
const Neighborhood neighborhood = Neighbor8 
)
inline

Constructor.

Parameters
x_startcolumn of the start pixel of the line
y_startrow of the start pixel of the line
x_endcolumn of the end pixel of the line
y_endrow of the end pixel of the line
widthwidth of the organized structure e.g. image/cloud/map etc..
neighborhoodconnectivity of the neighborhood

Definition at line 134 of file line_iterator.h.

References init().

pcl::LineIterator::~LineIterator ( )
inlinevirtual

Destructor.

Definition at line 145 of file line_iterator.h.

Member Function Documentation

unsigned pcl::LineIterator::getColumnIndex ( ) const
inlinevirtual

returns the col index (x-coordinate) of the current pixel/point

Returns
the col index (x-coordinate) of the current pixel/point

Reimplemented from pcl::OrganizedIndexIterator.

Definition at line 251 of file line_iterator.h.

References x_.

unsigned pcl::LineIterator::getRowIndex ( ) const
inlinevirtual

returns the row index (y-coordinate) of the current pixel/point

default implementation.

Returns
the row index (y-coordinate) of the current pixel/point

Should be overloaded

Reimplemented from pcl::OrganizedIndexIterator.

Definition at line 244 of file line_iterator.h.

References y_.

void pcl::LineIterator::init ( const Neighborhood neighborhood)
inlineprotected

initializes the variables for the Bresenham algorithm

Parameters
[in]neighborhoodconnectivity to the neighborhood. Either 4 or 8

Definition at line 151 of file line_iterator.h.

References error_, error_max_, error_minus_, error_plus_, pcl::OrganizedIndexIterator::index_, index_minus_, index_plus_, Neighbor4, pcl::OrganizedIndexIterator::width_, x_, x_end_, x_minus_, x_plus_, x_start_, y_, y_end_, y_minus_, y_plus_, and y_start_.

Referenced by LineIterator().

bool pcl::LineIterator::isValid ( ) const
inlinevirtual

return whether the current visited pixel/point is valid or not.

Returns
true if the current pixel/point is within the points to be iterated over, false otherwise

Implements pcl::OrganizedIndexIterator.

Definition at line 258 of file line_iterator.h.

References x_, x_end_, y_, and y_end_.

void pcl::LineIterator::operator++ ( )
inlinevirtual

go to next pixel/point in image/cloud

Implements pcl::OrganizedIndexIterator.

Definition at line 224 of file line_iterator.h.

References error_, error_max_, error_minus_, error_plus_, pcl::OrganizedIndexIterator::index_, index_minus_, index_plus_, x_, x_minus_, x_plus_, y_, y_minus_, and y_plus_.

void pcl::LineIterator::reset ( )
inlinevirtual

resets the iterator to the beginning of the line

Implements pcl::OrganizedIndexIterator.

Definition at line 265 of file line_iterator.h.

References error_, pcl::OrganizedIndexIterator::index_, pcl::OrganizedIndexIterator::width_, x_, x_start_, y_, and y_start_.

Member Data Documentation

int pcl::LineIterator::error_
protected

current distance to the line

Definition at line 98 of file line_iterator.h.

Referenced by init(), operator++(), and reset().

int pcl::LineIterator::error_max_
protected

error threshold

Definition at line 101 of file line_iterator.h.

Referenced by init(), and operator++().

int pcl::LineIterator::error_minus_
protected

increment of error (distance) value in case of an y-step (if dx > dy)

Definition at line 104 of file line_iterator.h.

Referenced by init(), and operator++().

int pcl::LineIterator::error_plus_
protected

increment of error (distance) value in case of just an x-step (if dx > dy)

Definition at line 107 of file line_iterator.h.

Referenced by init(), and operator++().

int pcl::LineIterator::index_minus_
protected

increment pixel/point index in case of just an y-step (if dx > dy)

Definition at line 125 of file line_iterator.h.

Referenced by init(), and operator++().

int pcl::LineIterator::index_plus_
protected

increment pixel/point index in case of just an x-step (if dx > dy)

Definition at line 122 of file line_iterator.h.

Referenced by init(), and operator++().

unsigned pcl::LineIterator::x_
protected

current column index

Definition at line 79 of file line_iterator.h.

Referenced by getColumnIndex(), init(), isValid(), operator++(), and reset().

unsigned pcl::LineIterator::x_end_
protected

column index of end pixel/point

Definition at line 91 of file line_iterator.h.

Referenced by init(), and isValid().

int pcl::LineIterator::x_minus_
protected

increment of column index in case of just an y-step (if dx > dy)

Definition at line 116 of file line_iterator.h.

Referenced by init(), and operator++().

int pcl::LineIterator::x_plus_
protected

increment of column index in case of just an x-step (if dx > dy)

Definition at line 110 of file line_iterator.h.

Referenced by init(), and operator++().

unsigned pcl::LineIterator::x_start_
protected

column index of first pixel/point

Definition at line 85 of file line_iterator.h.

Referenced by init(), and reset().

unsigned pcl::LineIterator::y_
protected

current row index

Definition at line 82 of file line_iterator.h.

Referenced by getRowIndex(), init(), isValid(), operator++(), and reset().

unsigned pcl::LineIterator::y_end_
protected

row index of end pixel/point

Definition at line 94 of file line_iterator.h.

Referenced by init(), and isValid().

int pcl::LineIterator::y_minus_
protected

increment of row index in case of just an y-step (if dx > dy)

Definition at line 119 of file line_iterator.h.

Referenced by init(), and operator++().

int pcl::LineIterator::y_plus_
protected

increment of row index in case of just an x-step (if dx > dy)

Definition at line 113 of file line_iterator.h.

Referenced by init(), and operator++().

unsigned pcl::LineIterator::y_start_
protected

row index of first pixel/point

Definition at line 88 of file line_iterator.h.

Referenced by init(), and reset().


The documentation for this class was generated from the following file: