Main Page | Data Structures | File List | Data Fields | Globals

rect_iter Struct Reference


Detailed Description

Rectangle points iterator.

The integer coordinates of pixels inside a rectangle are iteratively explored. This structure keep track of the process and functions ri_ini(), ri_inc(), ri_end(), and ri_del() are used in the process. An example of how to use the iterator is as follows:

      struct rect * rec = XXX; // some rectangle
      rect_iter * i;
      for( i=ri_ini(rec); !ri_end(i); ri_inc(i) )
        {
          // your code, using 'i->x' and 'i->y' as coordinates
        }
      ri_del(i); // delete iterator
The pixels are explored 'column' by 'column', where we call 'column' a set of pixels with the same x value that are inside the rectangle. The following is an schematic representation of a rectangle, the 'column' being explored is marked by colons, and the current pixel being explored is 'x,y'.

              vx[1],vy[1]
                 *   *
                *       *
               *           *
              *               ye
             *                :  *
        vx[0],vy[0]           :     *
               *              :        *
                  *          x,y          *
                     *        :              *
                        *     :            vx[2],vy[2]
                           *  :                *
        y                     ys              *
        ^                        *           *
        |                           *       *
        |                              *   *
        +---> x                      vx[3],vy[3]

    
The first 'column' to be explored is the one with the smaller x value. Each 'column' is explored starting from the pixel of the 'column' (inside the rectangle) with the smallest y value.

The four corners of the rectangle are stored in order that rotates around the corners at the arrays 'vx[]' and 'vy[]'. The first point is always the one with smaller x value.

'x' and 'y' are the coordinates of the pixel being explored. 'ys' and 'ye' are the start and end values of the current column being explored. So, 'ys' < 'ye'.

Definition at line 1259 of file lsd.c.

Data Fields

double vx [4]
double vy [4]
double ys
double ye
int x
int y


Field Documentation

double rect_iter::vx[4]
 

Definition at line 1261 of file lsd.c.

Referenced by ri_end(), ri_inc(), and ri_ini().

double rect_iter::vy[4]
 

Definition at line 1262 of file lsd.c.

Referenced by ri_inc(), and ri_ini().

int rect_iter::x
 

Definition at line 1264 of file lsd.c.

Referenced by rect_nfa(), ri_end(), ri_inc(), and ri_ini().

int rect_iter::y
 

Definition at line 1264 of file lsd.c.

Referenced by rect_nfa(), ri_inc(), and ri_ini().

double rect_iter::ye
 

Definition at line 1263 of file lsd.c.

Referenced by ri_inc(), and ri_ini().

double rect_iter::ys
 

Definition at line 1263 of file lsd.c.

Referenced by ri_inc(), and ri_ini().


The documentation for this struct was generated from the following file:
Generated on Fri Nov 11 11:11:11 2011 for LSD by doxygen 1.3.4