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 DigitalSurfaceEmbedderWithNormalVectorEstimator.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 DigitalSurfaceEmbedderWithNormalVectorEstimator.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 TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
44DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
45~DigitalSurfaceEmbedderWithNormalVectorEstimator()
48//-----------------------------------------------------------------------------
49template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
51DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
52DigitalSurfaceEmbedderWithNormalVectorEstimator()
53 : myDSEmbedder( 0 ), myEstimator( 0 )
56//-----------------------------------------------------------------------------
57template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
59DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
60DigitalSurfaceEmbedderWithNormalVectorEstimator
61( ConstAlias<DigitalSurfaceEmbedder> aDSEmbedder,
62 ConstAlias<NormalVectorEstimator> anEstimator )
63 : myDSEmbedder( &aDSEmbedder ),
64 myEstimator( &anEstimator )
67//-----------------------------------------------------------------------------
68template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
70DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
71DigitalSurfaceEmbedderWithNormalVectorEstimator
73 : myDSEmbedder( other.myDSEmbedder ),
74 myEstimator( other.myEstimator )
77//-----------------------------------------------------------------------------
78template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
80typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::Self &
81DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
85 myDSEmbedder = other.myDSEmbedder;
86 myEstimator = other.myEstimator;
90//-----------------------------------------------------------------------------
91template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
93const typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::Surface &
94DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
97 ASSERT( this->isValid() );
98 return myDSEmbedder->surface();
101//-----------------------------------------------------------------------------
102template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
104typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::RealPoint
105DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
106operator()( const SCell & scell ) const
108 ASSERT( this->isValid() );
109 return myDSEmbedder->operator()( scell );
112//-----------------------------------------------------------------------------
113template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
115typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::RealVector
116DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
117gradient( const SCell & scell ) const
119 ASSERT( this->isValid() );
120 return myEstimator->eval( scell );
123//-----------------------------------------------------------------------------
124template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
126typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::GradientMap
127DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
130 ASSERT( this->isValid() );
131 return GradientMap( *this );
134///////////////////////////////////////////////////////////////////////////////
135// Interface - public :
138 * Writes/Displays the object on an output stream.
139 * @param out the output stream where the object is written.
141template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
144DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
145selfDisplay ( std::ostream & out ) const
147 out << "[DigitalSurfaceEmbedderWithNormalVectorEstimator]";
151 * Checks the validity/consistency of the object.
152 * @return 'true' if the object is valid, 'false' otherwise.
154template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
157DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
160 return ( myEstimator != 0 ) && ( myDSEmbedder != 0 )
161 && ( myEstimator->isValid() ) && ( myDSEmbedder->isValid() );
164///////////////////////////////////////////////////////////////////////////////
165// class DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap
167//-----------------------------------------------------------------------------
168template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
170DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
171~DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap()
174//-----------------------------------------------------------------------------
175template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
177DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
178DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap()
182//-----------------------------------------------------------------------------
183template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
185DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
186DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap
187( ConstAlias<Embedder> embedder )
188 : myEmbedder( &embedder )
191//-----------------------------------------------------------------------------
192template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
194DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
195DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap
196( const Self & other )
197 : myEmbedder( other.myEmbedder )
200//-----------------------------------------------------------------------------
201template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
203typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::Self &
204DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
206( const Self & other )
208 myEmbedder = other.myEmbedder;
212//-----------------------------------------------------------------------------
213template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
215typename DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::Value
216DGtal::DigitalSurfaceEmbedderWithNormalVectorEstimatorGradientMap<TDigitalSurfaceEmbedder, TNormalVectorEstimator>::
217operator()( const Argument & arg ) const
219 ASSERT( myEmbedder != 0 );
220 return myEmbedder->gradient( arg );
224///////////////////////////////////////////////////////////////////////////////
225// Implementation of inline functions //
227template < typename TDigitalSurfaceEmbedder, typename TNormalVectorEstimator >
230DGtal::operator<< ( std::ostream & out,
231 const DigitalSurfaceEmbedderWithNormalVectorEstimator<TDigitalSurfaceEmbedder, TNormalVectorEstimator> & object )
233 object.selfDisplay( out );
238///////////////////////////////////////////////////////////////////////////////