2 * This program is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU Lesser General Public License as
4 * published by the Free Software Foundation, either version 3 of the
5 * License, or (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * @file NormalVectorEstimatorLinearCellEmbedder.ih
19 * @author David Coeurjolly (\c david.coeurjolly@liris.cnrs.fr )
20 * Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
24 * Implementation of inline methods defined in NormalVectorEstimatorLinearCellEmbedder.h
26 * This file is part of the DGtal library.
30//////////////////////////////////////////////////////////////////////////////
32//////////////////////////////////////////////////////////////////////////////
34///////////////////////////////////////////////////////////////////////////////
35// IMPLEMENTATION of inline methods.
36///////////////////////////////////////////////////////////////////////////////
38///////////////////////////////////////////////////////////////////////////////
39// ----------------------- Standard services ------------------------------
41//-----------------------------------------------------------------------------
42template < typename TKSpace, typename TNormalEstimator, typename TEmbedder >
44DGtal::NormalVectorEstimatorLinearCellEmbedder<TKSpace, TNormalEstimator, TEmbedder>::
45~NormalVectorEstimatorLinearCellEmbedder()
47//-----------------------------------------------------------------------------
48//-----------------------------------------------------------------------------
49template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
51DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
52NormalVectorEstimatorLinearCellEmbedder( ConstAlias<DigitalSurface> aSurface,
53 ConstAlias<NormalVectorEstimator> anEstim,
54 ConstAlias<Embedder> aEmb )
55 : mySurface(aSurface ),
59//-----------------------------------------------------------------------------
60template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
62typename DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::RealPoint
63DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
64embed( const Point & p ) const
66 //ASSERT( myPtrEmbedder.isValid() );
67 return myPtrEmbedder.embed( p );
69//-----------------------------------------------------------------------------
70template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
72typename DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::RealPoint
73DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
74embedSurfel( const ConstIterator & surfelIt ) const
76 ASSERT( this->isValid() );
78 // embed first the spel related to the cell.
79 Point p1( mySurface.container().space().sCoords( *surfelIt ) );
80 RealPoint x1( embed( p1 ) );
84//-----------------------------------------------------------------------------
85template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
88DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
89embedSurfel( const ConstIterator & surfelIt , RealPoint &p, RealVector &v) const
91 ASSERT( this->isValid() );
92 ASSERT( myPtrFct.isValid() );
93 // embed first the spel related to the cell.
94 p = embedSurfel( surfelIt );
95 v = myPtrFct.eval(surfelIt);
98///////////////////////////////////////////////////////////////////////////////
99// Interface - public :
102 * Writes/Displays the object on an output stream.
103 * @param out the output stream where the object is written.
105template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
108DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
109selfDisplay ( std::ostream & out ) const
111 out << "[NormalVectorEstimatorLinearCellEmbedder]";
115 * Checks the validity/consistency of the object.
116 * @return 'true' if the object is valid, 'false' otherwise.
118template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
121DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
124 return ( mySurface.isValid() ) && ( myPtrFct.isValid() );
125 //&& ( myPtrEmbedder.isValid() );
130///////////////////////////////////////////////////////////////////////////////
131// Implementation of inline functions //
133template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
136DGtal::operator<< ( std::ostream & out,
137 const NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder> & object )
139 object.selfDisplay( out );
144///////////////////////////////////////////////////////////////////////////////