CVR-Lib last update 20 Sep 2009

cvr::rectangleSide< T > Class Template Reference

Policy class to compute the size of a rectangle's side and the inverse transformation. More...

#include <cvrRectangle.h>

List of all members.

Static Public Member Functions

static T size (const T x1, const T x2)
static void invSize (const T sz, T &x1, T &x2)


Detailed Description

template<typename T>
class cvr::rectangleSide< T >

Policy class to compute the size of a rectangle's side and the inverse transformation.

For integer types it assumes the rectangle lies on a discrete grid with grid elements of size 1x1, which means that the size of a side defined by two scalar values x1 and x2 (x2>x1) is x2-x1+1.

For floating point values the size is just x2-x1, because of the assumption that the rectangle lies on a real valued 2D space.

The template parameter T represents the type used for the coordinates, and is usually int or float.


Member Function Documentation

template<typename T >
static void cvr::rectangleSide< T >::invSize ( const T  sz,
T &  x1,
T &  x2 
) [inline, static]

For a given side size, compute two coordinates which generates it.

For example:

  • if T is int and sz is 3, the returned values would be x1=-1 and x2=1.
  • if T is float and sz = 3, the returned values would be x1=-1.5 and x2=1.5

template<typename T >
static T cvr::rectangleSide< T >::size ( const T  x1,
const T  x2 
) [inline, static]

Return the size of a rectangle's side which is aligned with one of the two coordinates, assuming that the delimiting coordinates are x1 and x2.

For example:

  • if T is int, x1=0 and x2=2, then returns 3
  • if T is float, x1=0 and x2=2 then returns 2


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

Generated on Sun Sep 20 22:09:08 2009 for CVR-Lib by Doxygen 1.5.8