DGtal 1.3.0
Loading...
Searching...
No Matches
NormalVectorEstimatorLinearCellEmbedder.ih
1/**
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.
6 *
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.
11 *
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/>.
14 *
15 **/
16
17/**
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
21 *
22 * @date 2012/02/14
23 *
24 * Implementation of inline methods defined in NormalVectorEstimatorLinearCellEmbedder.h
25 *
26 * This file is part of the DGtal library.
27 */
28
29
30//////////////////////////////////////////////////////////////////////////////
31#include <cstdlib>
32//////////////////////////////////////////////////////////////////////////////
33
34///////////////////////////////////////////////////////////////////////////////
35// IMPLEMENTATION of inline methods.
36///////////////////////////////////////////////////////////////////////////////
37
38///////////////////////////////////////////////////////////////////////////////
39// ----------------------- Standard services ------------------------------
40
41//-----------------------------------------------------------------------------
42template < typename TKSpace, typename TNormalEstimator, typename TEmbedder >
43inline
44DGtal::NormalVectorEstimatorLinearCellEmbedder<TKSpace, TNormalEstimator, TEmbedder>::
45~NormalVectorEstimatorLinearCellEmbedder()
46{}
47//-----------------------------------------------------------------------------
48//-----------------------------------------------------------------------------
49template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
50inline
51DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
52NormalVectorEstimatorLinearCellEmbedder( ConstAlias<DigitalSurface> aSurface,
53 ConstAlias<NormalVectorEstimator> anEstim,
54 ConstAlias<Embedder> aEmb )
55 : mySurface(aSurface ),
56 myPtrFct( anEstim ),
57 myPtrEmbedder( aEmb )
58{}
59//-----------------------------------------------------------------------------
60template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
61inline
62typename DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::RealPoint
63DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
64embed( const Point & p ) const
65{
66 //ASSERT( myPtrEmbedder.isValid() );
67 return myPtrEmbedder.embed( p );
68}
69//-----------------------------------------------------------------------------
70template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
71inline
72typename DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::RealPoint
73DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
74embedSurfel( const ConstIterator & surfelIt ) const
75{
76 ASSERT( this->isValid() );
77
78 // embed first the spel related to the cell.
79 Point p1( mySurface.container().space().sCoords( *surfelIt ) );
80 RealPoint x1( embed( p1 ) );
81 return x1;
82}
83
84//-----------------------------------------------------------------------------
85template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
86inline
87void
88DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
89embedSurfel( const ConstIterator & surfelIt , RealPoint &p, RealVector &v) const
90{
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);
96}
97
98///////////////////////////////////////////////////////////////////////////////
99// Interface - public :
100
101/**
102 * Writes/Displays the object on an output stream.
103 * @param out the output stream where the object is written.
104 */
105template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
106inline
107void
108DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
109selfDisplay ( std::ostream & out ) const
110{
111 out << "[NormalVectorEstimatorLinearCellEmbedder]";
112}
113
114/**
115 * Checks the validity/consistency of the object.
116 * @return 'true' if the object is valid, 'false' otherwise.
117 */
118template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
119inline
120bool
121DGtal::NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder>::
122isValid() const
123{
124 return ( mySurface.isValid() ) && ( myPtrFct.isValid() );
125 //&& ( myPtrEmbedder.isValid() );
126}
127
128
129
130///////////////////////////////////////////////////////////////////////////////
131// Implementation of inline functions //
132
133template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
134inline
135std::ostream&
136DGtal::operator<< ( std::ostream & out,
137 const NormalVectorEstimatorLinearCellEmbedder<TDigitalSurface, TNormalEstimator, TEmbedder> & object )
138{
139 object.selfDisplay( out );
140 return out;
141}
142
143// //
144///////////////////////////////////////////////////////////////////////////////
145
146