SourceXtractorPlusPlus  0.16
Please provide a description of the project.
PixelRectangle.h
Go to the documentation of this file.
1 /*
2  * PixelRectangle.h
3  *
4  * Created on: Jun 9, 2021
5  * Author: mschefer
6  */
7 
8 #ifndef _SEUTILS_PIXELRECTANGLE_H_
9 #define _SEUTILS_PIXELRECTANGLE_H_
10 
12 
13 namespace SourceXtractor {
14 
16 public:
17 
19  m_min_coord{-1, -1}, m_max_coord{-1, -1} {}
20 
21  PixelRectangle(const PixelRectangle& rectangle) :
22  m_min_coord{rectangle.m_min_coord}, m_max_coord{rectangle.m_max_coord} {}
23 
25  m_min_coord{min_coord}, m_max_coord{max_coord} {
26  assert(min_coord.m_x <= max_coord.m_x && min_coord.m_y <= max_coord.m_y);
27  }
28 
30  assert(m_max_coord.m_x >= 0);
31  return m_min_coord;
32  }
33 
35  assert(m_max_coord.m_x >= 0);
36  return m_max_coord;
37  }
38 
39  int getWidth() const {
40  if (m_max_coord.m_x < 0)
41  return 0;
42  return m_max_coord.m_x - m_min_coord.m_x + 1;
43  }
44 
45  int getHeight() const {
46  if (m_max_coord.m_x < 0)
47  return 0;
48  return m_max_coord.m_y - m_min_coord.m_y + 1;
49  }
50 
51 private:
53 };
54 
55 }
56 
57 #endif /* _SEUTILS_PIXELRECTANGLE_H_ */
PixelCoordinate getTopLeft() const
PixelCoordinate getBottomRight() const
PixelRectangle(PixelCoordinate min_coord, PixelCoordinate max_coord)
PixelRectangle(const PixelRectangle &rectangle)
A pixel coordinate made of two integers m_x and m_y.