DGtal  0.9.3beta
Public Types | Static Public Member Functions
DGtal::Linearizer< HyperRectDomain< TSpace >, TStorageOrder > Struct Template Reference

#include <DGtal/kernel/domains/Linearizer.h>

Public Types

typedef HyperRectDomain< TSpace > Domain
 
typedef TSpace::Point Point
 
typedef Point Extent
 
typedef TSpace::Size Size
 

Static Public Member Functions

static Size getIndex (Point aPoint, Point const &aLowerBound, Extent const &anExtent)
 
static Size getIndex (Point aPoint, Extent const &anExtent)
 
static Size getIndex (Point aPoint, Domain const &aDomain)
 
static Point getPoint (Size anIndex, Point const &aLowerBound, Extent const &anExtent)
 
static Point getPoint (Size anIndex, Extent const &anExtent)
 
static Point getPoint (Size anIndex, Domain const &aDomain)
 

Detailed Description

template<typename TSpace, typename TStorageOrder>
struct DGtal::Linearizer< HyperRectDomain< TSpace >, TStorageOrder >

Aim: Linearization and de-linearization interface for HyperRectDomain.

This is a static class that provides point linearization (point to index) and de-linearization (index to point) for storages working on HyperRectDomain.

The storage order can be specified by template (default is colum-major ordered).

Example:

typedef SpaceND<2> Space;
tydedef HyperRectDomain<Space> Domain;
typedef typename Space::Point Point;
const Domain domain( Point(0, 1), Point(4, 3) );
typename Linearizer<Domain>::Size id = Linearizer<Domain>::getIndex( Point(2, 2), domain ); // returns 7.
Point pt = Linearizer<Domain>::getPoint( 7, domain); // returns Point(2,2).
Template Parameters
TSpaceType of the space of the HyperRectDomain (auto-deduced from TDomain template, see Linearizer).
TStorageOrderStorage Order (RowMajorStorage of ColMajorStorage).

Definition at line 107 of file Linearizer.h.

Member Typedef Documentation

template<typename TSpace , typename TStorageOrder >
typedef HyperRectDomain<TSpace> DGtal::Linearizer< HyperRectDomain< TSpace >, TStorageOrder >::Domain

The domain type.

Definition at line 110 of file Linearizer.h.

template<typename TSpace , typename TStorageOrder >
typedef Point DGtal::Linearizer< HyperRectDomain< TSpace >, TStorageOrder >::Extent

The domain's extent type.

Definition at line 112 of file Linearizer.h.

template<typename TSpace , typename TStorageOrder >
typedef TSpace::Point DGtal::Linearizer< HyperRectDomain< TSpace >, TStorageOrder >::Point

The point type.

Definition at line 111 of file Linearizer.h.

template<typename TSpace , typename TStorageOrder >
typedef TSpace::Size DGtal::Linearizer< HyperRectDomain< TSpace >, TStorageOrder >::Size

The space's size type.

Definition at line 113 of file Linearizer.h.

Member Function Documentation

template<typename TSpace , typename TStorageOrder >
static Size DGtal::Linearizer< HyperRectDomain< TSpace >, TStorageOrder >::getIndex ( Point  aPoint,
Point const &  aLowerBound,
Extent const &  anExtent 
)
inlinestatic

Linearized index of a point, given the domain lower-bound and extent.

Parameters
[in]aPointThe point to be linearized.
[in]aLowerBoundThe lower-bound of the domain.
[in]anExtentThe extent of the domain.
Returns
the linearized index of the point.
template<typename TSpace , typename TStorageOrder >
static Size DGtal::Linearizer< HyperRectDomain< TSpace >, TStorageOrder >::getIndex ( Point  aPoint,
Extent const &  anExtent 
)
inlinestatic

Linearized index of a point, given the domain extent.

The lower-bound of the domain is defined to the origin.

Parameters
[in]aPointThe Point to be linearized.
[in]anExtentThe extent of the domain.
Returns
the linearized index of the point.
template<typename TSpace , typename TStorageOrder >
static Size DGtal::Linearizer< HyperRectDomain< TSpace >, TStorageOrder >::getIndex ( Point  aPoint,
Domain const &  aDomain 
)
inlinestatic

Linearized index of a point, given a domain.

Parameters
[in]aPointThe Point to be linearized.
[in]aDomainThe domain.
Returns
the linearized index of the point.
template<typename TSpace , typename TStorageOrder >
static Point DGtal::Linearizer< HyperRectDomain< TSpace >, TStorageOrder >::getPoint ( Size  anIndex,
Point const &  aLowerBound,
Extent const &  anExtent 
)
inlinestatic

De-linearization of an index, given the domain lower-bound and extent.

Parameters
[in]anIndexThe linearized index.
[in]aLowerBoundThe lower-bound of the domain.
[in]anExtentThe domain extent.
Returns
the point whose linearized index is anIndex.
template<typename TSpace , typename TStorageOrder >
static Point DGtal::Linearizer< HyperRectDomain< TSpace >, TStorageOrder >::getPoint ( Size  anIndex,
Extent const &  anExtent 
)
inlinestatic

De-linearization of an index, given the domain extent.

The lower-bound of the domain is set to the origin.

Parameters
[in]anIndexThe linearized index.
[in]anExtentThe domain extent.
Returns
the point whose linearized index is anIndex.
template<typename TSpace , typename TStorageOrder >
static Point DGtal::Linearizer< HyperRectDomain< TSpace >, TStorageOrder >::getPoint ( Size  anIndex,
Domain const &  aDomain 
)
inlinestatic

De-linearization of an index, given a domain.

Parameters
[in]anIndexThe linearized index.
[in]aDomainThe domain.
Returns
the point whose linearized index is anIndex.

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