User Documentation
RAVL, Recognition And Vision Library
DEVELOP HOME PAGE CLASS LIST CONTENTS
Ravl - Core - Indexing


Indexing from 1-D to N-D for arrays, images and hash tables

Co-ordinate systems in RAVL

Before using these classes it is worth looking at the notes on the co-ordinate system conventions used in RAVL Ravl.Introduction.Coordinate_Systems - they aren't always quite what you expect. (It's one of those areas where it's impossible to keep everyone happy.)

Do I use IndexC or int?

The problems with the basic int type in C / C++ are manifold. Our main complaints are:

  • When an int is combined with an unsigned int, the int is converted to unsigned int before the operation is performed. This can lead to bizarre results for multiplication, division and modulo operators where one of the operands is negative.
  • The int division operator always rounds towards zero, as does conversion from float or double, regardless of the sign of the operands.
  • The size of many RAVL objects is returned as unsigned, which typically causes compilation warnings to be generated by comparison operations in loops etc. unless IndexC is used.

We have attempted to address these problems in the IndexC class, without sacrificing efficiency where possible. So, for anything that could be regarded as an index variable (for loop variables, array indices etc.) we would recommend using IndexC.

Basic classes:

 IndexC Index class for indexing 1D arrays: an integer class with modified rounding and other operations
 Index2dC 2 Dimensional index

Basic functions:

 operator >>(istream &,IndexC &)
 operator <<(ostream &,const IndexC &)
 operator +(IntT,const IndexC &)
 operator -(IntT,const IndexC &)
 operator *(IntT,const IndexC &)
 operator /(IntT,const IndexC &)
 operator +=(IntT &,const IndexC &)
 operator -=(IntT &,const IndexC &)
 operator *=(IntT &,const IndexC &)
 operator /=(IntT &,const IndexC &)
 operator ==(IntT,const IndexC &)
 operator !=(IntT,const IndexC &)
 operator <(IntT,const IndexC &)
 operator <=(IntT,const IndexC &)
 operator >(IntT,const IndexC &)
 operator >=(IntT,const IndexC &)
 operator +(const UIntT,const IndexC &)
 operator -(const UIntT,const IndexC &)
 operator *(const UIntT,const IndexC &)
 operator /(const UIntT,const IndexC &)
 operator +=(UIntT &,const IndexC &)
 operator -=(UIntT &,const IndexC &)
 operator *=(UIntT &,const IndexC &)
 operator /=(UIntT &,const IndexC &)
 operator ==(const UIntT,const IndexC &)
 operator !=(const UIntT,const IndexC &)
 operator <(const UIntT,const IndexC &)
 operator <=(const UIntT,const IndexC &)
 operator >(const UIntT,const IndexC &)
 operator >=(const UIntT,const IndexC &)
 operator +=(UByteT &,const IndexC &)
 operator -=(UByteT &,const IndexC &)
 operator *=(UByteT &,const IndexC &)
 operator /=(UByteT &,const IndexC &)
 operator ==(const UByteT,const IndexC &)
 operator !=(const UByteT,const IndexC &)
 operator <(const UByteT,const IndexC &)
 operator <=(const UByteT,const IndexC &)
 operator >(const UByteT,const IndexC &)
 operator >=(const UByteT,const IndexC &)
 operator +(RealT,const IndexC &)
 operator -(RealT,const IndexC &)
 operator *(RealT,const IndexC &)
 operator /(RealT,const IndexC &)
 operator +=(RealT &,const IndexC &)
 operator -=(RealT &,const IndexC &)
 operator *=(RealT &,const IndexC &)
 operator /=(RealT &,const IndexC &)
 operator ==(RealT,const IndexC &)
 operator !=(RealT,const IndexC &)
 operator <(RealT,const IndexC &)
 operator <=(RealT,const IndexC &)
 operator >(RealT,const IndexC &)
 operator >=(RealT,const IndexC &)
 Reverse(NeighbourOrderT) Get the opposite direction.

Normal classes:

 IndexRangeC 1D index range of array
 Index3dC Index of a 3-D array
 IndexRange2dC An index range of a 2D array
 IndexRange3dC An index range of a 3D array
 SubIndexRange2dIterC Slide a rectangular window over a larger rectangle.
 RealRangeC 1D Range of real values.
 SubIndexRange3dIterC Slide a rectangular window over a larger rectangle.
 RealRange2dC An index range of a 2D array
 RealRange3dC Range of real values in 3D
 IndexRange2dIterC Iterate through a 2d range.
 IndexRange3dIterC Iterate through a 3d range.

Normal functions:

 IsInside(IndexC,const IndexRangeC &) 1D index range of array
 operator >>(istream &,IndexRangeC &)
 operator <<(ostream &,const IndexRangeC &)
 operator <<(BinOStreamC &,const IndexRangeC &)
 operator >>(BinIStreamC &,IndexRangeC &)
 operator <<(ostream &,const IndexRange2dC &)
 operator >>(istream &,IndexRange2dC &)
 operator <<(BinOStreamC &,const IndexRange2dC &)
 operator >>(BinIStreamC &,IndexRange2dC &)
 operator <<(ostream &,const IndexRange3dC &)
 operator >>(istream &,IndexRange3dC &)
 operator <<(BinOStreamC &,const IndexRange3dC &)
 operator >>(BinIStreamC &,IndexRange3dC &)
 IsInside(RealT,const RealRangeC &) Returns true if the index 'i' is inside the index range 'r'.
 operator *(const RealRangeC &,const IndexRangeC &) Multiply an index range by a real range.
 operator >>(istream &,RealRangeC &) Read range from input stream.
 operator <<(ostream &,const RealRangeC &) Saves the index range 'r' into the output stream 's'.
 operator <<(BinOStreamC &,const RealRangeC &) Read range from binary stream.
 operator >>(BinIStreamC &,RealRangeC &) Write range to binary stream.
 operator *(const RealRange2dC &,const IndexRange2dC &) Multiply a 2d index range by a real 2d range.
 operator <<(ostream &,const RealRange2dC &)
 operator >>(istream &,RealRange2dC &)
 operator <<(BinOStreamC &,const RealRange2dC &)
 operator >>(BinIStreamC &,RealRange2dC &)
 operator *(const RealRange3dC &,const IndexRange3dC &) Multiply a 2d index range by a real 2d range.
 operator <<(ostream &,const RealRange3dC &)
 operator >>(istream &,RealRange3dC &)
 operator <<(BinOStreamC &,const RealRange3dC &)
 operator >>(BinIStreamC &,RealRange3dC &)

Advanced classes:

 FIndexC Fixed sized Index
Maintainer:Charles Galambos, Documentation by CxxDoc: Tue Aug 13 10:00:52 2002