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

#include <ImplicitFunctionDiff1LinearCellEmbedder.h>

Inheritance diagram for DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >:
Inheritance graph
[legend]

Public Types

typedef TKSpace KSpace
typedef TImplicitFunctionDiff1 ImplicitFunctionDiff1
typedef TEmbedder Embedder
typedef KSpace::Cell Cell
typedef KSpace::SCell SCell
typedef KSpace::Space Space
typedef Space::Point Point
typedef Space::RealPoint RealPoint
typedef Space::RealVector RealVector
typedef
ImplicitFunctionDiff1::Value 
ImplicitFctValue
typedef Cell Argument
typedef RealPoint Value
typedef
ImplicitFunctionDiff1LinearCellEmbedderGradientMap
< KSpace,
ImplicitFunctionDiff1,
Embedder
GradientMap

Public Member Functions

 ImplicitFunctionDiff1LinearCellEmbedder ()
 ~ImplicitFunctionDiff1LinearCellEmbedder ()
 ImplicitFunctionDiff1LinearCellEmbedder (const ImplicitFunctionDiff1LinearCellEmbedder &other)
ImplicitFunctionDiff1LinearCellEmbedderoperator= (const ImplicitFunctionDiff1LinearCellEmbedder &other)
void init (const KSpace &K, const ImplicitFunctionDiff1 &f, const Embedder &e)
GradientMap gradientMap () const
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 embed (const Point &p, RealPoint &x, RealVector &grad) const
void embedCell (const Cell &cell, RealPoint &x, RealVector &grad) const
void embedSCell (const SCell &scell, RealPoint &x, RealVector &grad) const
void selfDisplay (std::ostream &out) const
bool isValid () const

Protected Attributes

const KSpacemyPtrK
const ImplicitFunctionDiff1myPtrFct
const EmbeddermyPtrEmbedder

Private Member Functions

 BOOST_CONCEPT_ASSERT ((CCellularGridSpaceND< TKSpace >))
 BOOST_CONCEPT_ASSERT ((CImplicitFunctionDiff1< TImplicitFunctionDiff1 >))
 BOOST_CONCEPT_ASSERT ((CPointEmbedder< TEmbedder >))

Detailed Description

template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
class DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >

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

Description of template class 'ImplicitFunctionDiff1LinearCellEmbedder'

Template Parameters:
TKSpacethe cellular grid space definition, a model of CCellularGridSpaceND.
TImplicitFunctionDiff1the type of implicit function, a model of CImplicitFunctionDiff1.
TEmbedderthe type of digital embedder, a model of CPointEmbedder.
Todo:
assert dimensions of space, embedder and implicit function.

Definition at line 78 of file ImplicitFunctionDiff1LinearCellEmbedder.h.


Member Typedef Documentation

template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
typedef Cell DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::Argument
template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
typedef KSpace::Cell DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::Cell
template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
typedef TEmbedder DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::Embedder

Definition at line 87 of file ImplicitFunctionDiff1LinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
typedef ImplicitFunctionDiff1LinearCellEmbedderGradientMap< KSpace, ImplicitFunctionDiff1, Embedder > DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::GradientMap

Definition at line 98 of file ImplicitFunctionDiff1LinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
typedef ImplicitFunctionDiff1::Value DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::ImplicitFctValue

Definition at line 94 of file ImplicitFunctionDiff1LinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
typedef TImplicitFunctionDiff1 DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::ImplicitFunctionDiff1

Definition at line 86 of file ImplicitFunctionDiff1LinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
typedef TKSpace DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::KSpace

Definition at line 85 of file ImplicitFunctionDiff1LinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
typedef Space::Point DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::Point

Definition at line 91 of file ImplicitFunctionDiff1LinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
typedef Space::RealPoint DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::RealPoint
template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
typedef Space::RealVector DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::RealVector
template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
typedef KSpace::SCell DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::SCell

Definition at line 89 of file ImplicitFunctionDiff1LinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
typedef KSpace::Space DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::Space

Definition at line 90 of file ImplicitFunctionDiff1LinearCellEmbedder.h.

template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
typedef RealPoint DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::Value

Constructor & Destructor Documentation

template<typename TKSpace , typename TImplicitFunctionDiff1 , typename TEmbedder >
DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::ImplicitFunctionDiff1LinearCellEmbedder ( )
inline

Constructor. The object is not valid.

Definition at line 51 of file ImplicitFunctionDiff1LinearCellEmbedder.ih.

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

Destructor.

Definition at line 45 of file ImplicitFunctionDiff1LinearCellEmbedder.ih.

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

Copy constructor.

Parameters:
otherthe object to copy.

Definition at line 58 of file ImplicitFunctionDiff1LinearCellEmbedder.ih.

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

Member Function Documentation

template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::BOOST_CONCEPT_ASSERT ( (CCellularGridSpaceND< TKSpace >)  )
private
template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::BOOST_CONCEPT_ASSERT ( (CImplicitFunctionDiff1< TImplicitFunctionDiff1 >)  )
private
template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::BOOST_CONCEPT_ASSERT ( (CPointEmbedder< TEmbedder >)  )
private
template<typename TKSpace , typename TImplicitFunctionDiff1 , typename TEmbedder >
DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::RealPoint DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, 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 103 of file ImplicitFunctionDiff1LinearCellEmbedder.ih.

{
ASSERT( myPtrEmbedder != 0 );
return myPtrEmbedder->embed( p );
}
template<typename TKSpace , typename TImplicitFunctionDiff1 , typename TEmbedder >
void DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::embed ( const Point p,
RealPoint x,
RealVector grad 
) const
inline

Maps a digital point to its corresponding embedding position and gradient vector in the Euclidean space.

Parameters:
pany digital point in the digital space.
xits embedding in the Euclidean space.
grad(returns) its gradient vector at the point given by the current embedder in the Euclidean space.

Definition at line 170 of file ImplicitFunctionDiff1LinearCellEmbedder.ih.

{
x = embed( p );
grad = myPtrFct->gradient( x );
}
template<typename TKSpace , typename TImplicitFunctionDiff1 , typename TEmbedder >
DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::RealPoint DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, 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 113 of file ImplicitFunctionDiff1LinearCellEmbedder.ih.

{
return this->operator()( cell );
}
template<typename TKSpace , typename TImplicitFunctionDiff1 , typename TEmbedder >
void DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::embedCell ( const Cell cell,
RealPoint x,
RealVector grad 
) const
inline

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

Parameters:
cellany cell in the cellular grid space.
xits embedding in the Euclidean space.
grad(returns) its gradient vector at the point given by the current embedder in the Euclidean space.

Definition at line 180 of file ImplicitFunctionDiff1LinearCellEmbedder.ih.

{
x = embedCell( cell );
grad = myPtrFct->gradient( x );
}
template<typename TKSpace , typename TImplicitFunctionDiff1 , typename TEmbedder >
DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::RealPoint DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, 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 146 of file ImplicitFunctionDiff1LinearCellEmbedder.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 TImplicitFunctionDiff1 , typename TEmbedder >
void DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::embedSCell ( const SCell scell,
RealPoint x,
RealVector grad 
) const
inline

Maps a signed cell to its corresponding gradient vector 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.
xits embedding in the Euclidean space.
grad(returns) its gradient vector at the point given by the current embedder in the Euclidean space.

Definition at line 190 of file ImplicitFunctionDiff1LinearCellEmbedder.ih.

{
x = embedSCell( scell );
grad = myPtrFct->gradient( x );
}
template<typename TKSpace , typename TImplicitFunctionDiff1 , typename TEmbedder >
DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::GradientMap DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::gradientMap ( ) const
inline
Returns:
the corresponding gradient map.

Definition at line 94 of file ImplicitFunctionDiff1LinearCellEmbedder.ih.

{
return GradientMap( *this );
}
template<typename TKSpace , typename TImplicitFunctionDiff1 , typename TEmbedder >
void DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::init ( const KSpace K,
const ImplicitFunctionDiff1 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 ImplicitFunctionDiff1LinearCellEmbedder.ih.

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

Checks the validity/consistency of the object.

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

Definition at line 222 of file ImplicitFunctionDiff1LinearCellEmbedder.ih.

{
return ( myPtrK != 0 ) && ( myPtrFct != 0 ) && ( myPtrEmbedder != 0 );
}
template<typename TKSpace , typename TImplicitFunctionDiff1 , typename TEmbedder >
DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::RealPoint DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, 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.

Reimplemented in DGtal::ImplicitFunctionDiff1LinearCellEmbedderGradientMap< TKSpace, TImplicitFunctionDiff1, TEmbedder >.

Definition at line 122 of file ImplicitFunctionDiff1LinearCellEmbedder.ih.

Referenced by DGtal::ImplicitFunctionDiff1LinearCellEmbedderGradientMap< TKSpace, TImplicitFunctionDiff1, TEmbedder >::operator()().

{
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 TImplicitFunctionDiff1 , typename TEmbedder >
DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder > & DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::operator= ( const ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder > &  other)
inline
template<typename TKSpace , typename TImplicitFunctionDiff1 , typename TEmbedder >
void DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, 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 209 of file ImplicitFunctionDiff1LinearCellEmbedder.ih.

{
out << "[ImplicitFunctionDiff1LinearCellEmbedder]";
}

Field Documentation

template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
const Embedder* DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::myPtrEmbedder
protected
template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
const ImplicitFunctionDiff1* DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::myPtrFct
protected
template<typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder>
const KSpace* DGtal::ImplicitFunctionDiff1LinearCellEmbedder< TKSpace, TImplicitFunctionDiff1, TEmbedder >::myPtrK
protected

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