DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
NormalVectorEstimatorLinearCellEmbedder.ih
1 
30 
31 #include <cstdlib>
33 
35 // IMPLEMENTATION of inline methods.
37 
39 // ----------------------- Standard services ------------------------------
40 
41 //-----------------------------------------------------------------------------
42 template < typename TKSpace, typename TNormalEstimator, typename TEmbedder >
43 inline
46 {}
47 //-----------------------------------------------------------------------------
48 //-----------------------------------------------------------------------------
49 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
50 inline
53  const NormalVectorEstimator & anEstim,
54  const Embedder &aEmb )
55  : mySurface(aSurface ),
56  myPtrFct( anEstim ),
57  myPtrEmbedder( aEmb )
58 {}
59 //-----------------------------------------------------------------------------
60 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
61 inline
64 embed( const Point & p ) const
65 {
66  //ASSERT( myPtrEmbedder.isValid() );
67  return myPtrEmbedder.embed( p );
68 }
69 //-----------------------------------------------------------------------------
70 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
71 inline
74 embedSurfel( 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 //-----------------------------------------------------------------------------
85 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
86 inline
87 void
89 embedSurfel( 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 
99 // Interface - public :
100 
105 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
106 inline
107 void
109 selfDisplay ( std::ostream & out ) const
110 {
111  out << "[NormalVectorEstimatorLinearCellEmbedder]";
112 }
113 
118 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
119 inline
120 bool
122 isValid() const
123 {
124  return ( mySurface.isValid() ) && ( myPtrFct.isValid() );
125  //&& ( myPtrEmbedder.isValid() );
126 }
127 
128 
129 
131 // Implementation of inline functions //
132 
133 template < typename TDigitalSurface, typename TNormalEstimator, typename TEmbedder >
134 inline
135 std::ostream&
136 DGtal::operator<< ( std::ostream & out,
138 {
139  object.selfDisplay( out );
140  return out;
141 }
142 
143 // //
145 
146