DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CanonicSCellEmbedder.ih
1 
29 
30 // IMPLEMENTATION of inline methods.
32 
34 #include <cstdlib>
35 #include <cmath>
36 #include "DGtal/kernel/NumberTraits.h"
38 
39 
40 
42 // Implementation of inline methods //
43 //-----------------------------------------------------------------------------
44 template <typename TKSpace>
45 inline
48 {}
49 //-----------------------------------------------------------------------------
50 template <typename TKSpace>
51 inline
54  : myKSpace( 0 )
55 {}
56 //-----------------------------------------------------------------------------
57 template <typename TKSpace>
58 inline
60 CanonicSCellEmbedder( const KSpace & aKSpace )
61  : myKSpace( &aKSpace )
62 {}
63 //-----------------------------------------------------------------------------
64 template <typename TKSpace>
65 inline
67 CanonicSCellEmbedder( const Self & other )
68  : myKSpace( other.myKSpace )
69 {}
70 //-----------------------------------------------------------------------------
71 template <typename TKSpace>
72 inline
75 operator=( const Self & other )
76 {
77  myKSpace = other.myKSpace;
78  return *this;
79 }
80 //-----------------------------------------------------------------------------
81 template <typename TKSpace>
82 inline
85 {
86  ASSERT( this->isValid() );
87  return *myKSpace;
88 }
89 //-----------------------------------------------------------------------------
90 template <typename TKSpace>
91 inline
94 {
95  return this->operator()( scell );
96 }
97 //-----------------------------------------------------------------------------
98 template <typename TKSpace>
99 inline
102 {
103  ASSERT( this->isValid() );
104  Point dp = myKSpace->sKCoords( scell );
105  RealPoint p;
106  for ( Dimension i = 0; i < dp.size(); ++i )
107  p[ i ] = NumberTraits<Integer>::castToDouble( dp[ i ] ) / 2;
108  return p;
109 }
110 //-----------------------------------------------------------------------------
111 template <typename TKSpace>
112 inline
113 bool
115 {
116  return myKSpace != 0;
117 }
119 // Implementation of inline functions and external operators //
120 
127 template <typename TKSpace>
128 inline
129 std::ostream&
130 DGtal::operator<< ( std::ostream & out,
131  const CanonicSCellEmbedder<TKSpace> & object )
132 {
133  object.selfDisplay ( out );
134  return out;
135 }
136 
137 // //
139 
140