DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CanonicEmbedder.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 TSpace>
45 inline
48 {
49  Point dp;
50  for ( Dimension i = 0; i < dp.size(); ++i )
51  dp[ i ] = (Integer) floor( p[ i ] );
52  return dp;
53 }
54 //-----------------------------------------------------------------------------
55 template <typename TSpace>
56 inline
59 {
60  Point dp;
61  for ( Dimension i = 0; i < dp.size(); ++i )
62  dp[ i ] = (Integer) ceil( p[ i ] );
63  return dp;
64 }
65 //-----------------------------------------------------------------------------
66 template <typename TSpace>
67 inline
70 {
71  Point dp;
72  for ( Dimension i = 0; i < dp.size(); ++i )
73  dp[ i ] = (Integer) round( p[ i ] );
74  return dp;
75 }
76 //-----------------------------------------------------------------------------
77 template <typename TSpace>
78 inline
81 {
82  return this->operator()( dp );
83 }
84 //-----------------------------------------------------------------------------
85 template <typename TSpace>
86 inline
89 {
90  RealPoint p;
91  for ( Dimension i = 0; i < dp.size(); ++i )
92  p[ i ] = NumberTraits<Integer>::castToDouble( dp[ i ] );
93  return p;
94 }
95 //-----------------------------------------------------------------------------
96 template <typename TSpace>
97 inline
98 bool
100 {
101  return true;
102 }
104 // Implementation of inline functions and external operators //
105 
112 template <typename TSpace>
113 inline
114 std::ostream&
115 DGtal::operator<< ( std::ostream & out,
116  const CanonicEmbedder<TSpace> & object )
117 {
118  object.selfDisplay ( out );
119  return out;
120 }
121 
122 // //
124 
125