ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
rect_iter Struct Reference

Public Attributes

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

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
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
static rect_iter * ri_ini(struct rect *r)
Definition: lsd.c:1411
static int ri_end(rect_iter *i)
Definition: lsd.c:1325
static void ri_del(rect_iter *iter)
Definition: lsd.c:1314
static void ri_inc(rect_iter *i)
Definition: lsd.c:1341
Definition: lsd.c:1170

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.

Member Data Documentation

◆ vx

double rect_iter::vx[4]

Definition at line 1261 of file lsd.c.

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

◆ vy

double rect_iter::vy[4]

Definition at line 1262 of file lsd.c.

Referenced by ri_inc(), and ri_ini().

◆ x

int rect_iter::x

Definition at line 1264 of file lsd.c.

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

◆ y

int rect_iter::y

Definition at line 1264 of file lsd.c.

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

◆ ye

double rect_iter::ye

Definition at line 1263 of file lsd.c.

Referenced by ri_inc(), and ri_ini().

◆ ys

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: