SourceXtractorPlusPlus  0.11
Please provide a description of the project.
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
SourceXtractor::PixelCoordinate::operator==
bool operator==(const PixelCoordinate &other) const
Definition: PixelCoordinate.h:44
SourceXtractor::PixelCoordinate
A pixel coordinate made of two integers m_x and m_y.
Definition: PixelCoordinate.h:37
SourceXtractor::PixelCoordinate::operator-
PixelCoordinate operator-(const PixelCoordinate &other) const
Definition: PixelCoordinate.h:66
SourceXtractor::PixelCoordinate::PixelCoordinate
PixelCoordinate(int x, int y)
Definition: PixelCoordinate.h:42
SourceXtractor::PixelCoordinate::operator*
PixelCoordinate operator*(double scalar) const
Definition: PixelCoordinate.h:52
SourceXtractor
Definition: Aperture.h:30
SourceXtractor::PixelCoordinate::m_x
int m_x
Definition: PixelCoordinate.h:38
SourceXtractor::PixelCoordinate::m_y
int m_y
Definition: PixelCoordinate.h:38
SourceXtractor::PixelCoordinate::operator!=
bool operator!=(const PixelCoordinate &other) const
Definition: PixelCoordinate.h:48
SourceXtractor::PixelCoordinate::operator+=
PixelCoordinate & operator+=(const PixelCoordinate &other)
Definition: PixelCoordinate.h:60
SourceXtractor::PixelCoordinate::operator+
PixelCoordinate operator+(const PixelCoordinate &other) const
Definition: PixelCoordinate.h:56
SourceXtractor::PixelCoordinate::PixelCoordinate
PixelCoordinate()
Definition: PixelCoordinate.h:40
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition: MoffatModelFittingTask.cpp:93
std
STL namespace.
std::size_t
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition: MoffatModelFittingTask.cpp:93
SourceXtractor::PixelCoordinate::operator-=
PixelCoordinate & operator-=(const PixelCoordinate &other)
Definition: PixelCoordinate.h:70
std::hash
std::hash< SourceXtractor::PixelCoordinate >::operator()
std::size_t operator()(const SourceXtractor::PixelCoordinate &coord) const
Definition: PixelCoordinate.h:86