DGtal  1.5.beta
DGtal::Linearizer< HyperRectDomain< TSpace >, TStorageOrder > Struct Template Reference

Aim: Linearization and de-linearization interface for HyperRectDomain. More...

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

Public Types

typedef HyperRectDomain< TSpace > Domain
 The domain type. More...
 
typedef TSpace::Point Point
 The point type. More...
 
typedef Point Extent
 The domain's extent type. More...
 
typedef TSpace::Size Size
 The space's size type. More...
 

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).
HyperRectDomain< TSpace > Domain
The domain type.
Definition: Linearizer.h:110
MyPointD Point
Definition: testClone2.cpp:383
Domain domain
Linearizer< Domain, ColMajorStorage > Linearizer
HyperRectDomain< Space > Domain
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

◆ Domain

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.

◆ Extent

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.

◆ Point

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.

◆ Size

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

◆ getIndex() [1/3]

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.

◆ getIndex() [2/3]

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.

◆ getIndex() [3/3]

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.

◆ getPoint() [1/3]

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.

◆ getPoint() [2/3]

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.

◆ getPoint() [3/3]

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.

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