[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

details Diff2D Class Reference VIGRA

Two dimensional difference vector. More...

#include <vigra/diff2d.hxx>

Inheritance diagram for Diff2D:
Point2D Size2D

Public Types

typedef IteratorAdaptor
< Diff2DConstColumnIteratorPolicy
< Diff2D > > 
column_iterator
 
typedef Diff2D difference_type
 
typedef Diff2D index_reference
 
typedef image_traverser_tag iterator_category
 
typedef int MoveX
 
typedef int MoveY
 
typedef Diff2D PixelType
 
typedef Diff2D const * pointer
 
typedef Diff2D const & reference
 
typedef IteratorAdaptor
< Diff2DConstRowIteratorPolicy
< Diff2D > > 
row_iterator
 
typedef Diff2D value_type
 

Public Member Functions

column_iterator columnIterator () const
 
 Diff2D ()
 
 Diff2D (int ax, int ay)
 
 Diff2D (Diff2D const &v)
 
double magnitude () const
 
bool operator!= (Diff2D const &r) const
 
index_reference operator() (int const &dx, int const &dy) const
 
Diff2D operator* (int factor) const
 
Diff2D operator* (double factor) const
 
reference operator* () const
 
Diff2Doperator*= (int factor)
 
Diff2Doperator*= (double factor)
 
Diff2Doperator+= (Diff2D const &offset)
 
Diff2D operator- () const
 
Diff2Doperator-= (Diff2D const &offset)
 
pointer operator-> () const
 
Diff2D operator/ (int factor) const
 
Diff2D operator/ (double factor) const
 
Diff2Doperator/= (int factor)
 
Diff2Doperator/= (double factor)
 
Diff2Doperator= (Diff2D const &v)
 
bool operator== (Diff2D const &r) const
 
index_reference operator[] (Diff2D const &offset) const
 
int operator[] (int index) const
 
row_iterator rowIterator () const
 
int squaredMagnitude () const
 

Public Attributes

int x
 
int y
 

Detailed Description

Two dimensional difference vector.

This class acts primarily as a difference vector for specifying pixel coordinates and region sizes. In addition, Diff2D fulfills the requirements of an ImageIterator, so that it can be used to simulate an image whose pixels' values equal their coordinates. This secondary usage is explained on page CoordinateIterator.

Standard usage as a difference vector is mainly needed in the context of images. For example, Diff2D may be used as an index for operator[]:

vigra::Diff2D location(...);
value = image[location];

This is especially important in connection with accessors, where the offset variant of operator() takes only one offset object:

// accessor(iterator, dx, dy); is not allowed
value = accessor(iterator, vigra::Diff2D(dx, dy));

Diff2D is also returned by image.size(), so that we can create new images by calculating their size using Diff2D's arithmetic functions:

// create an image that is 10 pixels smaller in each direction
Image new_image(old_image.size() - Diff2D(10,10));

#include <vigra/diff2d.hxx>
Namespace: vigra

Examples:
profile.cxx, and smooth_convolve.cxx.

Member Typedef Documentation

typedef Diff2D PixelType

The iterator's value type: a coordinate.

typedef Diff2D value_type

The iterator's value type: a coordinate.

typedef Diff2D const& reference

the iterator's reference type (return type of *iter)

the iterator's index reference type (return type of iter[diff])

typedef Diff2D const* pointer

the iterator's pointer type (return type of iter.operator->())

the iterator's difference type (argument type of iter[diff])

typedef image_traverser_tag iterator_category

the iterator tag (image traverser)

typedef IteratorAdaptor<Diff2DConstRowIteratorPolicy<Diff2D> > row_iterator

The associated row iterator.

typedef IteratorAdaptor<Diff2DConstColumnIteratorPolicy<Diff2D> > column_iterator

The associated column iterator.

typedef int MoveX

type of the iterator's x-navigator

typedef int MoveY

type of the iterator's y-navigator

Constructor & Destructor Documentation

Diff2D ( )

Default Constructor. Init iterator at position (0,0)

Diff2D ( int  ax,
int  ay 
)

Construct at given position.

Diff2D ( Diff2D const &  v)

Copy Constructor.

Member Function Documentation

Diff2D& operator= ( Diff2D const &  v)

Copy Assigment.

Diff2D operator- ( ) const

Unary negation.

Diff2D& operator+= ( Diff2D const &  offset)

Increase coordinate by specified offset.

Diff2D& operator-= ( Diff2D const &  offset)

Decrease coordinate by specified vector.

Diff2D& operator*= ( int  factor)

Create vector by scaling by factor.

Diff2D& operator*= ( double  factor)

Create vector by scaling by factor.

Diff2D& operator/= ( int  factor)

Create vector by scaling by 1/factor.

Diff2D& operator/= ( double  factor)

Create vector by scaling by 1/factor.

Diff2D operator* ( int  factor) const

Create vector by scaling by factor.

Diff2D operator* ( double  factor) const

Create vector by scaling by factor.

Diff2D operator/ ( int  factor) const

Create vector by scaling by 1/factor.

Diff2D operator/ ( double  factor) const

Create vector by scaling by 1/factor.

int squaredMagnitude ( ) const

Calculate length of difference vector.

double magnitude ( ) const

Calculate length of difference vector.

bool operator== ( Diff2D const &  r) const

Equality.

bool operator!= ( Diff2D const &  r) const

Inequality.

reference operator* ( ) const

Access current coordinate.

index_reference operator() ( int const &  dx,
int const &  dy 
) const

Read coordinate at an offset.

index_reference operator[] ( Diff2D const &  offset) const

Read coordinate at an offset.

int operator[] ( int  index) const

Read vector components.

pointer operator-> ( ) const

Access current coordinate.

row_iterator rowIterator ( ) const

Get a row iterator at the current position.

column_iterator columnIterator ( ) const

Get a column iterator at the current position.

Member Data Documentation

int x

Used for both access to the current x-coordinate and to specify that an iterator navigation command is to be applied in x-direction.
usage: x = diff2d.x (use Diff2D::x as component of difference vector)
or   ++diff.x   (use Diff2D as iterator, move right)

int y

Used for both access to the current y-coordinate and to specify that an iterator navigation command is to be applied in y-direction.
usage: y = diff2d.y (use Diff2D::y as component of difference vector)
or   ++diff.y   (use Diff2D as iterator, move right)


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

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.11.1 (Fri May 19 2017)