TLIB documentation
 

tlSpiral Class Reference

List of all members.


Detailed Description

Spiral coordinates for pixel browsing.

A tlSpiral object provides a discrete spiral coordinates computation respectively to a given starting point. This allows a routine to address image pixels in a spiral sequence, which can be extremely useful for some correlation implementations or simply to find the closest filtered neighbor of a filtered pixel.

Public Member Functions

 tlSpiral (tlRect *rect=NULL)
 tlSpiral (int x0, int y0, int width, int height, tlRect *rect=NULL)
 tlSpiral (tlPoint *p0, int width, int height, tlRect *rect=NULL)
virtual ~tlSpiral ()
int init (int x0, int y0, int width, int height, tlRect *rect=NULL)
int init (tlPoint *p0, int width, int height, tlRect *rect=NULL)
int toNext ()
int toNext (tlPoint *point)
tlPointget ()
int get (tlPoint *point)
int getX ()
int getY ()
int getIndex ()
tlPointgetLast ()
int getLast (tlPoint *point)
int getLastX ()
int getLastY ()
int getLastIndex ()
tlPointgetNext ()
int getNext (tlPoint *point)
int getNextX ()
int getNextY ()
int getNextIndex ()


Constructor & Destructor Documentation

tlSpiral::tlSpiral ( tlRect rect = NULL  ) 

Constructor, creates a spiral centered relatively to the default image size.

Note:
See error management for details.

tlSpiral::tlSpiral ( int  x0,
int  y0,
int  width,
int  height,
tlRect rect = NULL 
)

Constructor, creates a spiral centered at the given point.

Parameters:
x0 spiral starting point on X axis
y0 spiral starting point on Y axis
width image width
height image height
rect portion of the image to consider
Note:
See error management for details.

tlSpiral::tlSpiral ( tlPoint p0,
int  width,
int  height,
tlRect rect = NULL 
)

Constructor, creates a spiral centered at the given point.

Parameters:
p0 spiral starting point
width image width
height image height
rect portion of the image to consider
Note:
See error management for details.

tlSpiral::~tlSpiral (  )  [virtual]

Destructor.

Note:
See error management for details.


Member Function Documentation

int tlSpiral::init ( int  x0,
int  y0,
int  width,
int  height,
tlRect rect = NULL 
)

Initialize the spiral around a given point, for an image of a given width, and within a certain portion of the image only.

Parameters:
x0 spiral starting point on X axis
y0 spiral starting point on Y axis
width image width
height image height
rect portion of the image to consider
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlSpiral::init ( tlPoint p0,
int  width,
int  height,
tlRect rect = NULL 
)

Initialize the spiral around a given point, for an image of a given width, and within a certain portion of the image only.

Parameters:
p0 spiral starting point
width image width
height image height
rect portion of the image to consider
Returns:
0 on success, -1 otherwise.
See error management for details.

int tlSpiral::toNext (  ) 

Moves on to the next point on the spiral.

Returns:
0 on success, -1 otherwise.
See error management for details.

int tlSpiral::toNext ( tlPoint point  ) 

Moves on to the next point on the spiral and place the new current location in a tlPoint.

Parameters:
point point that receives the new current location
Returns:
0 on success, -1 otherwise.
See error management for details.

tlPoint * tlSpiral::get (  )  [inline]

Return a tlPoint to the current position.

Returns:
A pointer to a tlPoint on success, NULL otherwise. See error management for details.
Remarks:
The return value points to a copy of the tlPoint. Therefore, you should explicitely delete the point after use to avoid memory leak. See get(tlPoint *point) to avoid allocating new memory.

int tlSpiral::get ( tlPoint point  )  [inline]

Fills a tlPoint with the current position.

Returns:
0 on success, -1 otherwise. See error management for details.
Remarks:
See get() to get a freshly allocated copy of the point.

int tlSpiral::getX (  )  [inline]

Return the current position in X.

Returns:
The current position in X on success, -1 otherwise. See error management for details.

int tlSpiral::getY (  )  [inline]

Return the current position in Y.

Returns:
The current position in Y on success, -1 otherwise. See error management for details.

int tlSpiral::getIndex (  )  [inline]

Return the pixel array index of the current pixel.

Returns:
The pixel array index of the current pixel on success, -1 otherwise. See error management for details.

tlPoint * tlSpiral::getLast (  )  [inline]

Return a tlPoint to the previous position.

Returns:
A pointer to a tlPoint on success, NULL otherwise. See error management for details.
Remarks:
The return value points to a copy of the tlPoint. Therefore, you should explicitely delete the point after use to avoid memory leak. See getLast(tlPoint *point) to avoid allocating new memory.

int tlSpiral::getLast ( tlPoint point  )  [inline]

Fills a tlPoint with the previous position.

Returns:
0 on success, -1 otherwise. See error management for details.
Remarks:
See getLast() to get a freshly allocated copy of the point.

int tlSpiral::getLastX (  )  [inline]

Return the previous position in X.

Returns:
The previous position in X on success, -1 otherwise. See error management for details.

int tlSpiral::getLastY (  )  [inline]

Return the previous position in Y.

Returns:
The previous position in Y on success, -1 otherwise. See error management for details.

int tlSpiral::getLastIndex (  )  [inline]

Return the pixel array index of the previous pixel.

Returns:
The pixel array index of the previous pixel on success, -1 otherwise. See error management for details.

tlPoint * tlSpiral::getNext (  )  [inline]

Return a tlPoint to the next position.

Returns:
A pointer to a tlPoint on success, NULL otherwise. See error management for details.
Remarks:
The return value points to a copy of the tlPoint. Therefore, you should explicitely delete the point after use to avoid memory leak. See getLast(tlPoint *point) to avoid allocating new memory.

int tlSpiral::getNext ( tlPoint point  )  [inline]

Fills a tlPoint with the next position.

Returns:
0 on success, -1 otherwise. See error management for details.
Remarks:
See getNext() to get a freshly allocated copy of the point.

int tlSpiral::getNextX (  )  [inline]

Return the next position in X.

Returns:
The next position in X on success, -1 otherwise. See error management for details.

int tlSpiral::getNextY (  )  [inline]

Return the next position in Y.

Returns:
The next position in Y on success, -1 otherwise. See error management for details.

int tlSpiral::getNextIndex (  )  [inline]

Return the pixel array index of the next pixel.

Returns:
The pixel array index of the next pixel on success, -1 otherwise. See error management for details.


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

TLIB documentation - generated on 7 May 2008
Please address any questions to seb@tuyphon.com
(C) 2001-2008 - S. Grange
(C) 2001-2007 - VRAI Group, EPFL
All Rights Reserved.