W3cubDocs

/PointCloudLibrary

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

#include <pcl/geometry/line_iterator.h>

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...
~LineIterator ()
Destructor. More...
void operator++ () override
go to next pixel/point in image/cloud More...
unsigned getRowIndex () const override
returns the row index (y-coordinate) of the current pixel/point More...
unsigned getColumnIndex () const override
returns the col index (x-coordinate) of the current pixel/point More...
bool isValid () const override
return whether the current visited pixel/point is valid or not. More...
void reset () override
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

Neighborhood connectivity

Enumerator
Neighbor4
Neighbor8

Definition at line 51 of file line_iterator.h.

Constructor & Destructor Documentation

LineIterator()

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_start column of the start pixel of the line
y_start row of the start pixel of the line
x_end column of the end pixel of the line
y_end row of the end pixel of the line
width width of the organized structure e.g. image/cloud/map etc..
neighborhood connectivity of the neighborhood

Definition at line 148 of file line_iterator.h.

References init().

~LineIterator()

pcl::LineIterator::~LineIterator ( )
inline

Destructor.

Definition at line 164 of file line_iterator.h.

Member Function Documentation

getColumnIndex()

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

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 260 of file line_iterator.h.

References x_.

getRowIndex()

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

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 253 of file line_iterator.h.

References y_.

init()

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

initializes the variables for the Bresenham algorithm

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

Definition at line 168 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().

isValid()

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

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 267 of file line_iterator.h.

References x_, x_end_, y_, and y_end_.

operator++()

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

go to next pixel/point in image/cloud

Implements pcl::OrganizedIndexIterator.

Definition at line 235 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_.

reset()

void pcl::LineIterator::reset ( )
inlineoverridevirtual

resets the iterator to the beginning of the line

Implements pcl::OrganizedIndexIterator.

Definition at line 274 of file line_iterator.h.

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

Member Data Documentation

error_

int pcl::LineIterator::error_
protected

current distance to the line

Definition at line 112 of file line_iterator.h.

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

error_max_

int pcl::LineIterator::error_max_
protected

error threshold

Definition at line 115 of file line_iterator.h.

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

error_minus_

int pcl::LineIterator::error_minus_
protected

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

Definition at line 118 of file line_iterator.h.

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

error_plus_

int pcl::LineIterator::error_plus_
protected

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

Definition at line 122 of file line_iterator.h.

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

index_minus_

int pcl::LineIterator::index_minus_
protected

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

Definition at line 140 of file line_iterator.h.

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

index_plus_

int pcl::LineIterator::index_plus_
protected

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

Definition at line 137 of file line_iterator.h.

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

x_

unsigned pcl::LineIterator::x_
protected

current column index

Definition at line 93 of file line_iterator.h.

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

x_end_

unsigned pcl::LineIterator::x_end_
protected

column index of end pixel/point

Definition at line 105 of file line_iterator.h.

Referenced by init(), and isValid().

x_minus_

int pcl::LineIterator::x_minus_
protected

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

Definition at line 131 of file line_iterator.h.

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

x_plus_

int pcl::LineIterator::x_plus_
protected

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

Definition at line 125 of file line_iterator.h.

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

x_start_

unsigned pcl::LineIterator::x_start_
protected

column index of first pixel/point

Definition at line 99 of file line_iterator.h.

Referenced by init(), and reset().

y_

unsigned pcl::LineIterator::y_
protected

current row index

Definition at line 96 of file line_iterator.h.

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

y_end_

unsigned pcl::LineIterator::y_end_
protected

row index of end pixel/point

Definition at line 108 of file line_iterator.h.

Referenced by init(), and isValid().

y_minus_

int pcl::LineIterator::y_minus_
protected

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

Definition at line 134 of file line_iterator.h.

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

y_plus_

int pcl::LineIterator::y_plus_
protected

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

Definition at line 128 of file line_iterator.h.

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

y_start_

unsigned pcl::LineIterator::y_start_
protected

row index of first pixel/point

Definition at line 102 of file line_iterator.h.

Referenced by init(), and reset().


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

© 2009–2012, Willow Garage, Inc.
© 2012–, Open Perception, Inc.
Licensed under the BSD License.
https://pointclouds.org/documentation/classpcl_1_1_line_iterator.html