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 //-----------------------------------------------------------------------------
42 template < typename TKSpace, typename TNormalEstimator, typename TEmbedder >
44 DGtal::NormalVectorEstimatorLinearCellEmbedder<TKSpace, TNormalEstimator, TEmbedder>::
45 ~NormalVectorEstimatorLinearCellEmbedder()
47 //-----------------------------------------------------------------------------
48 //-----------------------------------------------------------------------------
49 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
51 DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
52 NormalVectorEstimatorLinearCellEmbedder( ConstAlias<DigitalSurface> aSurface,
53 ConstAlias<NormalVectorEstimator> anEstim,
54 ConstAlias<Embedder> aEmb )
55 : mySurface(aSurface ),
59 //-----------------------------------------------------------------------------
60 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
62 typename DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::RealPoint
63 DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
64 embed( const Point & p ) const
66 //ASSERT( myPtrEmbedder.isValid() );
67 return myPtrEmbedder.embed( p );
69 //-----------------------------------------------------------------------------
70 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
72 typename DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::RealPoint
73 DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
74 embedSurfel( 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 //-----------------------------------------------------------------------------
85 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
88 DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
89 embedSurfel( 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.
105 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
108 DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
109 selfDisplay ( 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.
118 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
121 DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
124 return ( mySurface.isValid() ) && ( myPtrFct.isValid() );
125 //&& ( myPtrEmbedder.isValid() );
130 ///////////////////////////////////////////////////////////////////////////////
131 // Implementation of inline functions //
133 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
136 DGtal::operator<< ( std::ostream & out,
137 const NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder> & object )
139 object.selfDisplay( out );
144 ///////////////////////////////////////////////////////////////////////////////