SourceXtractorPlusPlus  0.8
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PixelCoordinate.h
Go to the documentation of this file.
1 
23 #ifndef _SEUTILS_PIXELCOORDINATE_H
24 #define _SEUTILS_PIXELCOORDINATE_H
25 
26 #include <functional>
27 #include <boost/functional/hash.hpp>
28 
29 namespace SourceXtractor {
30 
38  int m_x, m_y;
39 
40  PixelCoordinate() : m_x(0), m_y(0) {}
41 
42  PixelCoordinate(int x, int y) : m_x(x), m_y(y) {}
43 
44  bool operator==(const PixelCoordinate& other) const {
45  return m_x == other.m_x && m_y == other.m_y;
46  }
47 
48  bool operator!=(const PixelCoordinate& other) const {
49  return !(*this == other);
50  }
51 
52  PixelCoordinate operator*(double scalar) const {
53  return PixelCoordinate(m_x * scalar, m_y * scalar);
54  }
55 
57  return PixelCoordinate(m_x + other.m_x, m_y + other.m_y);
58  }
59 
61  m_x += other.m_x;
62  m_y += other.m_y;
63  return *this;
64  }
65 
67  return PixelCoordinate(m_x - other.m_x, m_y - other.m_y);
68  }
69 
71  m_x -= other.m_x;
72  m_y -= other.m_y;
73  return *this;
74  }
75 };
76 
77 
78 } /* namespace SourceXtractor */
79 
80 
81 namespace std {
82 
83 template <>
84 struct hash<SourceXtractor::PixelCoordinate>
85 {
87  std::size_t hash = 0;
88  boost::hash_combine(hash, coord.m_x);
89  boost::hash_combine(hash, coord.m_y);
90  return hash;
91  }
92 };
93 
94 } // namespace std
95 
96 
97 #endif
PixelCoordinate operator-(const PixelCoordinate &other) const
bool operator!=(const PixelCoordinate &other) const
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
bool operator==(const PixelCoordinate &other) const
std::size_t operator()(const SourceXtractor::PixelCoordinate &coord) const
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
PixelCoordinate & operator-=(const PixelCoordinate &other)
A pixel coordinate made of two integers m_x and m_y.
PixelCoordinate operator+(const PixelCoordinate &other) const
PixelCoordinate operator*(double scalar) const
PixelCoordinate & operator+=(const PixelCoordinate &other)