DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Data Structures | Public Types | Public Member Functions | Data Fields | Static Public Attributes | Private Member Functions | Private Attributes
DGtal::HyperRectDomain< TSpace > Class Template Reference

#include <HyperRectDomain.h>

Collaboration diagram for DGtal::HyperRectDomain< TSpace >:
Collaboration graph
[legend]

Data Structures

struct  ConstSubRange
 Aim: range through some subdomain of all the points in the domain. Defines a constructor taking a domain in parameter plus some additional parameters to specify the subdomain, begin and end methods returning ConstIterator, and rbegin and rend methods returning ConstReverseIterator. More...

Public Types

typedef HyperRectDomain< TSpace > Self
typedef TSpace Space
typedef HyperRectDomain< SpaceDomain
typedef Space::Point Point
typedef Space::Integer Integer
typedef Space::Vector Vector
typedef Space::Dimension Dimension
typedef Space::Size Size
typedef Point::Coordinate Coordinate
typedef
HyperRectDomain_Iterator
< Point
Iterator
typedef myreverse_iterator
< Iterator
ReverseIterator
typedef Iterator ConstIterator
typedef ReverseIterator ConstReverseIterator
typedef IsWithinPointPredicate
< Point
Predicate

Public Member Functions

 HyperRectDomain ()
 HyperRectDomain (const Point &aPointA, const Point &aPointB)
 ~HyperRectDomain ()
 HyperRectDomain (const HyperRectDomain &other)
HyperRectDomainoperator= (const HyperRectDomain &other)
const ConstIteratorbegin () const
ConstIterator begin (const Point &aPoint) const
const ConstIteratorend () const
ConstReverseIterator rbegin () const
ConstReverseIterator rbegin (const Point &aPoint) const
ConstReverseIterator rend () const
ConstSubRange subRange (const std::vector< Dimension > &permutation) const
ConstSubRange subRange (const std::vector< Dimension > &permutation, const Point &startingPoint) const
ConstSubRange subRange (Dimension adim, const Point &startingPoint) const
ConstSubRange subRange (Dimension adim1, Dimension adim2, const Point &startingPoint) const
ConstSubRange subRange (Dimension adim1, Dimension adim2, Dimension adim3, const Point &startingPoint) const
Vector extent () const
Size size () const
const PointlowerBound () const
const PointupperBound () const
bool isInside (const Point &p) const
const Predicatepredicate () const
std::string className () const
void selfDisplay (std::ostream &out) const
bool isValid () const

Data Fields

Point myLowerBound
Point myUpperBound

Static Public Attributes

static const Space::Dimension dimension = Space::dimension

Private Member Functions

 BOOST_CONCEPT_ASSERT ((CSpace< TSpace >))

Private Attributes

Predicate myPredicate
ConstIterator myIteratorBegin
ConstIterator myIteratorEnd

Detailed Description

template<typename TSpace>
class DGtal::HyperRectDomain< TSpace >

Aim: Parallelepidec region of a digital space, model of a 'CDomain'.

Description of class 'HyperRectDomain'

The following code snippet demonstrates how to use HyperRectDomain

#include <DGtal/kernel/Space.h>
#include <DGtal/kernel/domains/HyperRectDomain.h>
...
//We create a digital Space based on 'int' integers and in dimension 4
typedef DGtal::Space<4> Space4D;
typedef Space4D::TPoint Point4D;
const int rawA[ ] = { 1, 2, 3 ,4};
const int rawB[ ] = { 5, 5, 3 ,4};
Point4D A ( rawA );
Point4D B ( rawB );
//Domain construction from two points
//We iterate on the Domain points and print out the point coordinates.
std::copy ( myDomain.begin(),
myDomain.end(),
std::ostream_iterator<Point4D> ( std::cout, " " ) );
See also:
testHyperRectDomain.cpp
testHyperRectDomain-snippet.cpp
Examples:
io/boards/dgtalBoard2D-1-points.cpp, io/boards/dgtalBoard2D-3-custom-classes.cpp, io/boards/dgtalBoard2D-3-custom-points.cpp, logoDGtal.cpp, topology/3dBorderExtraction.cpp, topology/ctopo-1-3d.cpp, topology/ctopo-1.cpp, topology/ctopo-1s-3d.cpp, and topology/khalimskySpaceScanner.cpp.

Definition at line 92 of file HyperRectDomain.h.


Member Typedef Documentation

template<typename TSpace>
typedef Iterator DGtal::HyperRectDomain< TSpace >::ConstIterator

Definition at line 119 of file HyperRectDomain.h.

template<typename TSpace>
typedef ReverseIterator DGtal::HyperRectDomain< TSpace >::ConstReverseIterator

Definition at line 120 of file HyperRectDomain.h.

template<typename TSpace>
typedef Point::Coordinate DGtal::HyperRectDomain< TSpace >::Coordinate

Definition at line 114 of file HyperRectDomain.h.

template<typename TSpace>
typedef Space::Dimension DGtal::HyperRectDomain< TSpace >::Dimension

Definition at line 112 of file HyperRectDomain.h.

template<typename TSpace>
typedef HyperRectDomain<Space> DGtal::HyperRectDomain< TSpace >::Domain

Definition at line 108 of file HyperRectDomain.h.

template<typename TSpace>
typedef Space::Integer DGtal::HyperRectDomain< TSpace >::Integer

Definition at line 110 of file HyperRectDomain.h.

template<typename TSpace>
typedef HyperRectDomain_Iterator<Point> DGtal::HyperRectDomain< TSpace >::Iterator

Typedef of domain iterators.

Definition at line 117 of file HyperRectDomain.h.

template<typename TSpace>
typedef Space::Point DGtal::HyperRectDomain< TSpace >::Point

Definition at line 109 of file HyperRectDomain.h.

template<typename TSpace>
typedef IsWithinPointPredicate<Point> DGtal::HyperRectDomain< TSpace >::Predicate

Definition at line 122 of file HyperRectDomain.h.

template<typename TSpace>
typedef myreverse_iterator<Iterator> DGtal::HyperRectDomain< TSpace >::ReverseIterator

Definition at line 118 of file HyperRectDomain.h.

template<typename TSpace>
typedef HyperRectDomain<TSpace> DGtal::HyperRectDomain< TSpace >::Self

Definition at line 99 of file HyperRectDomain.h.

template<typename TSpace>
typedef Space::Size DGtal::HyperRectDomain< TSpace >::Size

Definition at line 113 of file HyperRectDomain.h.

template<typename TSpace>
typedef TSpace DGtal::HyperRectDomain< TSpace >::Space

Definition at line 103 of file HyperRectDomain.h.

template<typename TSpace>
typedef Space::Vector DGtal::HyperRectDomain< TSpace >::Vector

Definition at line 111 of file HyperRectDomain.h.


Constructor & Destructor Documentation

template<typename TSpace >
DGtal::HyperRectDomain< TSpace >::HyperRectDomain ( )
inline
template<typename TSpace >
DGtal::HyperRectDomain< TSpace >::HyperRectDomain ( const Point aPointA,
const Point aPointB 
)
inline

Constructor from two points

Parameters:
aPointAand
aPointBdefining the space diagonal.

Definition at line 54 of file HyperRectDomain.ih.

References DGtal::HyperRectDomain< TSpace >::myIteratorEnd.

template<typename TSpace >
DGtal::HyperRectDomain< TSpace >::~HyperRectDomain ( )
inline

Destructor.

Definition at line 85 of file HyperRectDomain.ih.

{}
template<typename TSpace>
DGtal::HyperRectDomain< TSpace >::HyperRectDomain ( const HyperRectDomain< TSpace > &  other)

Copy constructor.

Parameters:
otherthe object to clone. Forbidden by default.

Member Function Documentation

template<typename TSpace>
const ConstIterator& DGtal::HyperRectDomain< TSpace >::begin ( ) const
inline

Definition at line 162 of file HyperRectDomain.h.

References DGtal::HyperRectDomain< TSpace >::myIteratorBegin.

Referenced by DGtal::HyperRectDomain< TSpace >::rbegin(), and DGtal::HyperRectDomain< TSpace >::rend().

{ return myIteratorBegin; }
template<typename TSpace>
ConstIterator DGtal::HyperRectDomain< TSpace >::begin ( const Point aPoint) const
inline

Definition at line 171 of file HyperRectDomain.h.

References DGtal::HyperRectDomain< TSpace >::isInside(), DGtal::HyperRectDomain< TSpace >::myLowerBound, and DGtal::HyperRectDomain< TSpace >::myUpperBound.

{ ASSERT(isInside(aPoint));
return ConstIterator(aPoint,
template<typename TSpace>
DGtal::HyperRectDomain< TSpace >::BOOST_CONCEPT_ASSERT ( (CSpace< TSpace >)  )
private
template<typename TSpace >
std::string DGtal::HyperRectDomain< TSpace >::className ( ) const
inline

Default drawing style object.

Returns:
the dyn. alloc. default style for this object.
the style name used for drawing this object.
Examples:
logoDGtal.cpp, topology/ctopo-1-3d.cpp, topology/ctopo-1.cpp, topology/ctopo-1s-3d.cpp, and topology/khalimskySpaceScanner.cpp.

Definition at line 169 of file HyperRectDomain.ih.

Referenced by DGtal::Display3DFactory::draw(), and DGtal::Display2DFactory::draw().

{
return "HyperRectDomain";
}
template<typename TSpace>
const ConstIterator& DGtal::HyperRectDomain< TSpace >::end ( ) const
inline

Definition at line 180 of file HyperRectDomain.h.

References DGtal::HyperRectDomain< TSpace >::myIteratorEnd.

Referenced by DGtal::HyperRectDomain< TSpace >::rbegin().

{ return myIteratorEnd; }
template<typename TSpace>
Vector DGtal::HyperRectDomain< TSpace >::extent ( ) const
inline
Returns:
the extent of the HyperRectDomain

Definition at line 488 of file HyperRectDomain.h.

References DGtal::PointVector< dim, Integer >::diagonal(), DGtal::HyperRectDomain< TSpace >::myLowerBound, and DGtal::HyperRectDomain< TSpace >::myUpperBound.

Referenced by DGtal::HyperRectDomain< TSpace >::size().

{
return (myUpperBound - myLowerBound) + p;
}
template<typename TSpace >
bool DGtal::HyperRectDomain< TSpace >::isInside ( const Point p) const
inline
Parameters:
pany point.
Returns:
'true' if point [p] is inside this domain.

Definition at line 126 of file HyperRectDomain.ih.

Referenced by DGtal::HyperRectDomain< TSpace >::begin(), and DGtal::HyperRectDomain< TSpace >::rbegin().

{
return myPredicate( p );
//LowerBound.isLower( p ) && myUpperBound.isUpper( p );
}
template<typename TSpace >
bool DGtal::HyperRectDomain< TSpace >::isValid ( ) const
inline

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.

Definition at line 160 of file HyperRectDomain.ih.

{
return true;
}
template<typename TSpace >
const DGtal::HyperRectDomain< TSpace >::Point & DGtal::HyperRectDomain< TSpace >::lowerBound ( ) const
inline

Returns the lowest point of the space diagonal.

Examples:
topology/khalimskySpaceScanner.cpp.

Definition at line 118 of file HyperRectDomain.ih.

{
return myLowerBound;
}
template<typename TSpace>
DGtal::HyperRectDomain< TSpace > & DGtal::HyperRectDomain< TSpace >::operator= ( const HyperRectDomain< TSpace > &  other)
inline

Assignment.

Parameters:
otherthe object to copy.
Returns:
a reference on 'this'. Forbidden by default.

Definition at line 92 of file HyperRectDomain.ih.

References DGtal::HyperRectDomain< TSpace >::myLowerBound.

template<typename TSpace >
const DGtal::HyperRectDomain< TSpace >::Predicate & DGtal::HyperRectDomain< TSpace >::predicate ( ) const
inline
Returns:
a const reference to the "IsInside" predicate.

NB: Could have used template class DomainPredicate but, for performance reason, directly used the IsWithinPointPredicate which fits perfectly.

Definition at line 135 of file HyperRectDomain.ih.

{
return myPredicate;
}
template<typename TSpace>
ConstReverseIterator DGtal::HyperRectDomain< TSpace >::rbegin ( ) const
inline

Definition at line 187 of file HyperRectDomain.h.

References DGtal::HyperRectDomain< TSpace >::end().

{ return ConstReverseIterator(end()); }
template<typename TSpace>
ConstReverseIterator DGtal::HyperRectDomain< TSpace >::rbegin ( const Point aPoint) const
inline

Definition at line 196 of file HyperRectDomain.h.

References DGtal::HyperRectDomain< TSpace >::begin(), and DGtal::HyperRectDomain< TSpace >::isInside().

{ ASSERT(isInside(aPoint));
ConstIterator it(begin(aPoint)); ++it;
return ConstReverseIterator(it); }
template<typename TSpace>
ConstReverseIterator DGtal::HyperRectDomain< TSpace >::rend ( ) const
inline

Definition at line 205 of file HyperRectDomain.h.

References DGtal::HyperRectDomain< TSpace >::begin().

{ return ConstReverseIterator(begin()); }
template<typename TSpace >
void DGtal::HyperRectDomain< TSpace >::selfDisplay ( std::ostream &  out) const
inline

Writes/Displays the object on an output stream.

Parameters:
outthe output stream where the object is written.

Definition at line 151 of file HyperRectDomain.ih.

{
out << "[HyperRectDomain] = [" << myLowerBound << "]x["
<< myUpperBound << "]";
}
template<typename TSpace>
Size DGtal::HyperRectDomain< TSpace >::size ( ) const
inline
Returns:
the size (number of points) of the HyperRectDomain

Definition at line 498 of file HyperRectDomain.h.

References DGtal::PointVector< dim, TEuclideanRing >::begin(), DGtal::PointVector< dim, TEuclideanRing >::end(), and DGtal::HyperRectDomain< TSpace >::extent().

{
Size res = 1;
Vector e = this->extent();
typename Vector::ConstIterator it, itEnd;
for ( it = e.begin(), itEnd = e.end();
it != itEnd; ++it)
{
res *= *it;
}
return res;
}
template<typename TSpace>
ConstSubRange DGtal::HyperRectDomain< TSpace >::subRange ( const std::vector< Dimension > &  permutation) const
inline

get a subRange.

Parameters:
permutationa vector containing the dimensions used for the subrange. Dimensions are iterated in the given order.
Returns:
a sub-range of the domain for the given permutation.

Definition at line 408 of file HyperRectDomain.h.

References DGtal::HyperRectDomain< TSpace >::myLowerBound.

Referenced by DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::computeFirstStep(), DGtal::VoronoiMap< TSpace, TPointPredicate, p >::computeOtherSteps(), and DGtal::DistanceTransformation< TSpace, TPointPredicate, p, IntegerLong >::computeOtherSteps().

{ return ConstSubRange(*this, permutation, myLowerBound); }
template<typename TSpace>
ConstSubRange DGtal::HyperRectDomain< TSpace >::subRange ( const std::vector< Dimension > &  permutation,
const Point startingPoint 
) const
inline

get a subRange from an initial point.

Parameters:
permutationa vector containing the dimensions used for the subrange. Dimensions are iterated in the given order.
startingPointthe initial point.
Returns:
a sub-range of the domain for the given permutation.
Precondition:
startingPoint must belong to the range.

Definition at line 419 of file HyperRectDomain.h.

{ return ConstSubRange(*this, permutation, startingPoint); }
template<typename TSpace>
ConstSubRange DGtal::HyperRectDomain< TSpace >::subRange ( Dimension  adim,
const Point startingPoint 
) const
inline

get a subRange of one dimension.

Parameters:
adimthe dimension of the subrange.
startingPointthe initial point.
Returns:
a sub-range of the domain for the given dimension.
Precondition:
startingPoint must belong to the range.

Definition at line 430 of file HyperRectDomain.h.

{ return ConstSubRange(*this, adim, startingPoint); }
template<typename TSpace>
ConstSubRange DGtal::HyperRectDomain< TSpace >::subRange ( Dimension  adim1,
Dimension  adim2,
const Point startingPoint 
) const
inline

get a subRange of two dimensions.

Parameters:
adim1the first dimension of the subrange.
adim2the second dimension of the subrange.
startingPointthe initial point.
Returns:
a sub-range of the domain for the given two dimensions.
Precondition:
startingPoint must belong to the range.

Definition at line 442 of file HyperRectDomain.h.

{ return ConstSubRange(*this, adim1, adim2, startingPoint); }
template<typename TSpace>
ConstSubRange DGtal::HyperRectDomain< TSpace >::subRange ( Dimension  adim1,
Dimension  adim2,
Dimension  adim3,
const Point startingPoint 
) const
inline

get a subRange of three dimensions.

Parameters:
adim1the first dimension of the subrange.
adim2the second dimension of the subrange.
adim3the third dimension of the subrange.
startingPointthe initial point.
Returns:
a sub-range of the domain for the given three dimensions.
Precondition:
startingPoint must belong to the range.

Definition at line 455 of file HyperRectDomain.h.

{ return ConstSubRange(*this, adim1, adim2, adim3, startingPoint); }
template<typename TSpace >
const DGtal::HyperRectDomain< TSpace >::Point & DGtal::HyperRectDomain< TSpace >::upperBound ( ) const
inline

Returns the highest point of the space diagonal.

Examples:
topology/khalimskySpaceScanner.cpp.

Definition at line 143 of file HyperRectDomain.ih.

{
return myUpperBound;
}

Field Documentation

template<typename TSpace>
const Space::Dimension DGtal::HyperRectDomain< TSpace >::dimension = Space::dimension
static

Definition at line 106 of file HyperRectDomain.h.

template<typename TSpace>
ConstIterator DGtal::HyperRectDomain< TSpace >::myIteratorBegin
private

Begin iterator.

Definition at line 585 of file HyperRectDomain.h.

Referenced by DGtal::HyperRectDomain< TSpace >::begin().

template<typename TSpace>
ConstIterator DGtal::HyperRectDomain< TSpace >::myIteratorEnd
private

End iterator.

Definition at line 587 of file HyperRectDomain.h.

Referenced by DGtal::HyperRectDomain< TSpace >::end(), and DGtal::HyperRectDomain< TSpace >::HyperRectDomain().

template<typename TSpace>
Point DGtal::HyperRectDomain< TSpace >::myLowerBound

The lowest point of the space diagonal.

Definition at line 575 of file HyperRectDomain.h.

Referenced by DGtal::HyperRectDomain< TSpace >::begin(), DGtal::Display3DFactory::drawAsBoundingBox(), DGtal::Display3DFactory::drawAsGrid(), DGtal::Display2DFactory::drawAsGrid(), DGtal::Display3DFactory::drawAsPaving(), DGtal::Display2DFactory::drawAsPaving(), DGtal::Display3DFactory::drawAsPavingPoints(), DGtal::HyperRectDomain< TSpace >::extent(), DGtal::HyperRectDomain< TSpace >::operator=(), and DGtal::HyperRectDomain< TSpace >::subRange().

template<typename TSpace>
Predicate DGtal::HyperRectDomain< TSpace >::myPredicate
private

"IsInside" predicate.

Definition at line 582 of file HyperRectDomain.h.

template<typename TSpace>
Point DGtal::HyperRectDomain< TSpace >::myUpperBound

The highest point of the space diagonal.

Definition at line 577 of file HyperRectDomain.h.

Referenced by DGtal::HyperRectDomain< TSpace >::begin(), DGtal::Display3DFactory::drawAsBoundingBox(), DGtal::Display3DFactory::drawAsGrid(), DGtal::Display2DFactory::drawAsGrid(), DGtal::Display3DFactory::drawAsPaving(), DGtal::Display2DFactory::drawAsPaving(), DGtal::Display3DFactory::drawAsPavingPoints(), and DGtal::HyperRectDomain< TSpace >::extent().


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