Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
rect_iter Struct Reference
+ Collaboration diagram for rect_iter:

Data Fields

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 int ri_end(rect_iter *i)
Definition ashift_lsd.c:1374
static rect_iter * ri_ini(struct rect *r)
Definition ashift_lsd.c:1460
static void ri_del(rect_iter *iter)
Definition ashift_lsd.c:1363
static void ri_inc(rect_iter *i)
Definition ashift_lsd.c:1390
Definition ashift_lsd.c:1309
int y
Definition ashift_lsd.c:1313
Definition ashift_lsd.c:1219

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'.

Field Documentation

◆ vx

double rect_iter::vx[4]

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

◆ vy

double rect_iter::vy[4]

Referenced by ri_inc(), and ri_ini().

◆ x

int rect_iter::x

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

◆ y

int rect_iter::y

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

◆ ye

double rect_iter::ye

Referenced by ri_inc(), and ri_ini().

◆ ys

double rect_iter::ys

Referenced by ri_inc(), and ri_ini().


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