DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes
DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder > Class Template Reference

#include <ImplicitFunctionLinearCellEmbedder.h>

Public Types

typedef TKSpace KSpace
typedef TImplicitFunction ImplicitFunction
typedef TEmbedder Embedder
typedef KSpace::Cell Cell
typedef KSpace::SCell SCell
typedef KSpace::Space Space
typedef Space::Point Point
typedef Space::RealPoint RealPoint
typedef ImplicitFunction::Value ImplicitFctValue
typedef Cell Argument
typedef RealPoint Value

Public Member Functions

 ImplicitFunctionLinearCellEmbedder ()
 ~ImplicitFunctionLinearCellEmbedder ()
 ImplicitFunctionLinearCellEmbedder (const ImplicitFunctionLinearCellEmbedder &other)
ImplicitFunctionLinearCellEmbedderoperator= (const ImplicitFunctionLinearCellEmbedder &other)
void init (const KSpace &K, const ImplicitFunction &f, const Embedder &e)
RealPoint embed (const Point &p) const
RealPoint embedCell (const Cell &cell) const
RealPoint embedSCell (const SCell &scell) const
RealPoint operator() (const Cell &cell) const
void selfDisplay (std::ostream &out) const
bool isValid () const

Private Member Functions

 BOOST_CONCEPT_ASSERT ((CImplicitFunction< TImplicitFunction >))

Private Attributes

const KSpacemyPtrK
const ImplicitFunctionmyPtrFct
const EmbeddermyPtrEmbedder

Detailed Description

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
class DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >

Aim: a cellular embedder for implicit functions, (default constructible, copy constructible, assignable). Model of CCellEmbedder.

Description of template class 'ImplicitFunctionLinearCellEmbedder'

Template Parameters:
TKSpacethe cellular grid space definition.
TImplicitFunctionthe type of implicit function, a model of CImplicitFunction.
TEmbedderthe type of digital embedder.
Todo:
assert dimensions of space, embedder and implicit function.

Definition at line 69 of file ImplicitFunctionLinearCellEmbedder.h.


Member Typedef Documentation

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
typedef Cell DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::Argument

Definition at line 83 of file ImplicitFunctionLinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
typedef KSpace::Cell DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::Cell

Definition at line 77 of file ImplicitFunctionLinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
typedef TEmbedder DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::Embedder

Definition at line 76 of file ImplicitFunctionLinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
typedef ImplicitFunction::Value DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::ImplicitFctValue

Definition at line 82 of file ImplicitFunctionLinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
typedef TImplicitFunction DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::ImplicitFunction

Definition at line 75 of file ImplicitFunctionLinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
typedef TKSpace DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::KSpace

Definition at line 74 of file ImplicitFunctionLinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
typedef Space::Point DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::Point

Definition at line 80 of file ImplicitFunctionLinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
typedef Space::RealPoint DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::RealPoint

Definition at line 81 of file ImplicitFunctionLinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
typedef KSpace::SCell DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::SCell

Definition at line 78 of file ImplicitFunctionLinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
typedef KSpace::Space DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::Space

Definition at line 79 of file ImplicitFunctionLinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
typedef RealPoint DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::Value

Definition at line 84 of file ImplicitFunctionLinearCellEmbedder.h.


Constructor & Destructor Documentation

template<typename TKSpace , typename TImplicitFunction , typename TEmbedder >
DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::ImplicitFunctionLinearCellEmbedder ( )
inline

Constructor. The object is not valid.

Definition at line 51 of file ImplicitFunctionLinearCellEmbedder.ih.

: myPtrK( 0 ), myPtrFct( 0 ), myPtrEmbedder( 0 )
{}
template<typename TKSpace , typename TImplicitFunction , typename TEmbedder >
DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::~ImplicitFunctionLinearCellEmbedder ( )
inline

Destructor.

Definition at line 45 of file ImplicitFunctionLinearCellEmbedder.ih.

{}
template<typename TKSpace , typename TImplicitFunction , typename TEmbedder >
DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::ImplicitFunctionLinearCellEmbedder ( const ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder > &  other)
inline

Copy constructor.

Parameters:
otherthe object to copy.

Definition at line 58 of file ImplicitFunctionLinearCellEmbedder.ih.

: myPtrK( other.myPtrK ),
myPtrFct( other.myPtrFct ),
myPtrEmbedder( other.myPtrEmbedder )
{}

Member Function Documentation

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::BOOST_CONCEPT_ASSERT ( (CImplicitFunction< TImplicitFunction >)  )
private
template<typename TKSpace , typename TImplicitFunction , typename TEmbedder >
DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::RealPoint DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::embed ( const Point p) const
inline

Maps a digital point to its corresponding point in the Euclidean space.

Parameters:
pany digital point in the digital space.
Returns:
its embedding by the current embedder in the Euclidean space.

Definition at line 94 of file ImplicitFunctionLinearCellEmbedder.ih.

{
ASSERT( myPtrEmbedder != 0 );
return myPtrEmbedder->embed( p );
}
template<typename TKSpace , typename TImplicitFunction , typename TEmbedder >
DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::RealPoint DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::embedCell ( const Cell cell) const
inline

Maps a cell to its corresponding point in the Euclidean space, by a linear guess of its position.

Parameters:
cellany cell in the cellular grid space.
Returns:
its embedding in the Euclidean space.

Definition at line 104 of file ImplicitFunctionLinearCellEmbedder.ih.

{
return this->operator()( cell );
}
template<typename TKSpace , typename TImplicitFunction , typename TEmbedder >
DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::RealPoint DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::embedSCell ( const SCell scell) const
inline

Maps a signed cell to its corresponding point in the Euclidean space, by a linear guess of its position. NB: the signed is not used.

Parameters:
scellany cell in the cellular grid space.
Returns:
its embedding in the Euclidean space.

Definition at line 137 of file ImplicitFunctionLinearCellEmbedder.ih.

{
ASSERT( this->isValid() );
// embed first the spel related to the cell.
Point p1( myPtrK->sCoords( scell ) );
RealPoint x1( embed( p1 ) );
ImplicitFctValue y1 = (*myPtrFct)( x1 );
for ( typename KSpace::DirIterator qit = myPtrK->sOrthDirs( scell );
qit != 0; ++qit )
{ // cell is closed along this dimension.
// estimate coordinate by interpolation, looking for f(...)=0.
Dimension k = *qit;
Point p2( p1 ); --p2[ k ];
RealPoint x2( embed( p2 ) );
ImplicitFctValue y2 = (*myPtrFct)( x2 );
x1[ k ] -= y1 * ( x2[ k ] - x1[ k ] ) / ( y2 - y1 );
}
return x1;
}
template<typename TKSpace , typename TImplicitFunction , typename TEmbedder >
void DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::init ( const KSpace K,
const ImplicitFunction f,
const Embedder e 
)
inline

Initializes the embedder with the space K, the implicit function f, the digital embedder e.

Parameters:
Kany cellular grid space.
fan implicit function
ea digital embedder (like a GaussDigitizer).

Definition at line 83 of file ImplicitFunctionLinearCellEmbedder.ih.

{
myPtrK = &K;
myPtrFct = &f;
}
template<typename TKSpace , typename TImplicitFunction , typename TEmbedder >
bool DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::isValid ( ) const
inline

Checks the validity/consistency of the object.

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

Definition at line 182 of file ImplicitFunctionLinearCellEmbedder.ih.

{
return ( myPtrK != 0 ) && ( myPtrFct != 0 ) && ( myPtrEmbedder != 0 );
}
template<typename TKSpace , typename TImplicitFunction , typename TEmbedder >
DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::RealPoint DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::operator() ( const Cell cell) const
inline

Maps a cell to its corresponding point in the Euclidean space, by a linear guess of its position.

Parameters:
cellany cell in the cellular grid space.
Returns:
its embedding in the Euclidean space.

Definition at line 113 of file ImplicitFunctionLinearCellEmbedder.ih.

{
ASSERT( this->isValid() );
// embed first the spel related to the cell.
Point p1( myPtrK->uCoords( cell ) );
RealPoint x1( embed( p1 ) );
ImplicitFctValue y1 = (*myPtrFct)( x1 );
for ( typename KSpace::DirIterator qit = myPtrK->uOrthDirs( cell );
qit != 0; ++qit )
{ // cell is closed along this dimension.
// estimate coordinate by interpolation, looking for f(...)=0.
Dimension k = *qit;
Point p2( p1 ); --p2[ k ];
RealPoint x2( embed( p2 ) );
ImplicitFctValue y2 = (*myPtrFct)( x2 );
x1[ k ] -= y1 * ( x2[ k ] - x1[ k ] ) / ( y2 - y1 );
}
return x1;
}
template<typename TKSpace , typename TImplicitFunction , typename TEmbedder >
DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder > & DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::operator= ( const ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder > &  other)
inline

Assignment.

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

Definition at line 68 of file ImplicitFunctionLinearCellEmbedder.ih.

References DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::myPtrEmbedder, DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::myPtrFct, and DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::myPtrK.

{
if ( this != &other )
{
myPtrK = other.myPtrK;
myPtrFct = other.myPtrFct;
myPtrEmbedder = other.myPtrEmbedder;
}
return *this;
}
template<typename TKSpace , typename TImplicitFunction , typename TEmbedder >
void DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::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 169 of file ImplicitFunctionLinearCellEmbedder.ih.

{
out << "[ImplicitFunctionLinearCellEmbedder]";
}

Field Documentation

template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
const Embedder* DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::myPtrEmbedder
private
template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
const ImplicitFunction* DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::myPtrFct
private
template<typename TKSpace, typename TImplicitFunction, typename TEmbedder>
const KSpace* DGtal::ImplicitFunctionLinearCellEmbedder< TKSpace, TImplicitFunction, TEmbedder >::myPtrK
private

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