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

Public Types | Public Member Functions | Public Attributes | List of all members
Diff2D Class Reference

Two dimensional difference vector. More...

`#include <vigra/diff2d.hxx>`

Inheritance diagram for Diff2D:

## 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 (Diff2D const &v)
| Diff2D (int ax, int ay)
double | magnitude () const
bool | operator!= (Diff2D const &r) const
index_reference | operator() (int const &dx, int const &dy) const
reference | operator* () const
Diff2D | operator* (double factor) const
Diff2D | operator* (int factor) const
Diff2D & | operator*= (double factor)
Diff2D & | operator*= (int factor)
Diff2D & | operator+= (Diff2D const &offset)
Diff2D | operator- () const
Diff2D & | operator-= (Diff2D const &offset)
pointer | operator-> () const
Diff2D | operator/ (double factor) const
Diff2D | operator/ (int factor) const
Diff2D & | operator/= (double factor)
Diff2D & | operator/= (int factor)
Diff2D & | operator= (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];
vigra::Diff2D
Two dimensional difference vector.
Definition diff2d.hxx:186

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));
vigra::Diff2D::Diff2D
Diff2D()
Definition diff2d.hxx:234

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

Examples
  profile.cxx, and smooth_convolve.cxx.

## Member Typedef Documentation

## ◆ PixelType

typedef Diff2D PixelType

The iterator's value type: a coordinate.

## ◆ value_type

typedef Diff2D value_type

The iterator's value type: a coordinate.

## ◆ reference

typedef Diff2D const& reference

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

## ◆ index_reference

typedef Diff2D index_reference

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

## ◆ pointer

typedef Diff2D const* pointer

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

## ◆ difference_type

typedef Diff2D difference_type

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

## ◆ iterator_category

typedef image_traverser_tag iterator_category

the iterator tag (image traverser)

## ◆ row_iterator

typedef IteratorAdaptor<Diff2DConstRowIteratorPolicy<Diff2D> > row_iterator

The associated row iterator.

## ◆ column_iterator

typedef IteratorAdaptor<Diff2DConstColumnIteratorPolicy<Diff2D> > column_iterator

The associated column iterator.

## ◆ MoveX

typedef int MoveX

type of the iterator's x-navigator

## ◆ MoveY

typedef int MoveY

type of the iterator's y-navigator

## Constructor & Destructor Documentation

## ◆ Diff2D() [1/3]

Diff2D | ( |  | ) |

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

## ◆ Diff2D() [2/3]

Diff2D | ( | int | ax,
|  | int | ay )

Construct at given position.

## ◆ Diff2D() [3/3]

Diff2D | ( | Diff2D const & | v | ) |

Copy Constructor.

## Member Function Documentation

## ◆ operator=()

Diff2D & operator= | ( | Diff2D const & | v | ) |

Copy Assigment.

## ◆ operator-()

Diff2D operator- | ( |  | ) | const

Unary negation.

## ◆ operator+=()

Diff2D & operator+= | ( | Diff2D const & | offset | ) |

Increase coordinate by specified offset.

## ◆ operator-=()

Diff2D & operator-= | ( | Diff2D const & | offset | ) |

Decrease coordinate by specified vector.

## ◆ operator*=() [1/2]

Diff2D & operator*= | ( | int | factor | ) |

Create vector by scaling by factor.

## ◆ operator*=() [2/2]

Diff2D & operator*= | ( | double | factor | ) |

Create vector by scaling by factor.

## ◆ operator/=() [1/2]

Diff2D & operator/= | ( | int | factor | ) |

Create vector by scaling by 1/factor.

## ◆ operator/=() [2/2]

Diff2D & operator/= | ( | double | factor | ) |

Create vector by scaling by 1/factor.

## ◆ operator*() [1/3]

Diff2D operator* | ( | int | factor | ) | const

Create vector by scaling by factor.

## ◆ operator*() [2/3]

Diff2D operator* | ( | double | factor | ) | const

Create vector by scaling by factor.

## ◆ operator/() [1/2]

Diff2D operator/ | ( | int | factor | ) | const

Create vector by scaling by 1/factor.

## ◆ operator/() [2/2]

Diff2D operator/ | ( | double | factor | ) | const

Create vector by scaling by 1/factor.

## ◆ squaredMagnitude()

int squaredMagnitude | ( |  | ) | const

Calculate length of difference vector.

## ◆ magnitude()

double magnitude | ( |  | ) | const

Calculate length of difference vector.

## ◆ operator==()

bool operator== | ( | Diff2D const & | r | ) | const

Equality.

## ◆ operator!=()

bool operator!= | ( | Diff2D const & | r | ) | const

Inequality.

## ◆ operator*() [3/3]

reference operator* | ( |  | ) | const

Access current coordinate.

## ◆ operator()()

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

Read coordinate at an offset.

## ◆ operator[]() [1/2]

index_reference operator[] | ( | Diff2D const & | offset | ) | const

Read coordinate at an offset.

## ◆ operator[]() [2/2]

int operator[] | ( | int | index | ) | const

Read vector components.

## ◆ operator->()

pointer operator-> | ( |  | ) | const

Access current coordinate.

## ◆ rowIterator()

row_iterator rowIterator | ( |  | ) | const

Get a row iterator at the current position.

## ◆ columnIterator()

column_iterator columnIterator | ( |  | ) | const

Get a column iterator at the current position.

## Member Data Documentation

## ◆ x

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)

## ◆ y

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:

- vigra/diff2d.hxx

© 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.12.4