GClasses
GClasses::GRegionBorderIterator Class Reference

Detailed Description

Iterates the border of a 2D region by running around the border and reporting the coordinates of each interior border pixel and the direction to the edge. It goes in a counter-clockwise direction.

#include <GRegion.h>

Public Member Functions

 GRegionBorderIterator (GImage *pImage, int nSampleX, int nSampleY)
 The point (nSampleX, nSampleY) should be somewhere in the region The image pImage should be a region mask, such that all points in the same region have exactly the same pixel value. More...
 
 ~GRegionBorderIterator ()
 
bool next (int *pX, int *pY, int *pDirection)
 If it returns false, the current values are invalid and it's done. If it returns true, pX and pY will hold the coordinates of an interior border pixel. pDirection will be the direction to the edge. 0=right, 1=up, 2=left, 3=down. More...
 

Protected Member Functions

void leap ()
 
bool look ()
 

Protected Attributes

bool m_bOddPass
 
int m_direction
 
int m_endX
 
int m_endY
 
unsigned int m_nRegion
 
GImagem_pImage
 
int m_x
 
int m_y
 

Constructor & Destructor Documentation

GClasses::GRegionBorderIterator::GRegionBorderIterator ( GImage pImage,
int  nSampleX,
int  nSampleY 
)

The point (nSampleX, nSampleY) should be somewhere in the region The image pImage should be a region mask, such that all points in the same region have exactly the same pixel value.

GClasses::GRegionBorderIterator::~GRegionBorderIterator ( )

Member Function Documentation

void GClasses::GRegionBorderIterator::leap ( )
protected
bool GClasses::GRegionBorderIterator::look ( )
protected
bool GClasses::GRegionBorderIterator::next ( int *  pX,
int *  pY,
int *  pDirection 
)

If it returns false, the current values are invalid and it's done. If it returns true, pX and pY will hold the coordinates of an interior border pixel. pDirection will be the direction to the edge. 0=right, 1=up, 2=left, 3=down.

Member Data Documentation

bool GClasses::GRegionBorderIterator::m_bOddPass
protected
int GClasses::GRegionBorderIterator::m_direction
protected
int GClasses::GRegionBorderIterator::m_endX
protected
int GClasses::GRegionBorderIterator::m_endY
protected
unsigned int GClasses::GRegionBorderIterator::m_nRegion
protected
GImage* GClasses::GRegionBorderIterator::m_pImage
protected
int GClasses::GRegionBorderIterator::m_x
protected
int GClasses::GRegionBorderIterator::m_y
protected