SourceXtractorPlusPlus
0.16
Please provide a description of the project.
SEUtils
SEUtils
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
11
#include "
SEUtils/PixelCoordinate.h
"
12
13
namespace
SourceXtractor
{
14
15
class
PixelRectangle
{
16
public
:
17
18
PixelRectangle
():
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
24
PixelRectangle
(
PixelCoordinate
min_coord,
PixelCoordinate
max_coord):
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
29
PixelCoordinate
getTopLeft
()
const
{
30
assert(
m_max_coord
.
m_x
>= 0);
31
return
m_min_coord
;
32
}
33
34
PixelCoordinate
getBottomRight
()
const
{
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
:
52
PixelCoordinate
m_min_coord
,
m_max_coord
;
53
};
54
55
}
56
57
#endif
/* _SEUTILS_PIXELRECTANGLE_H_ */
PixelCoordinate.h
SourceXtractor::PixelRectangle
Definition:
PixelRectangle.h:15
SourceXtractor::PixelRectangle::m_max_coord
PixelCoordinate m_max_coord
Definition:
PixelRectangle.h:52
SourceXtractor::PixelRectangle::m_min_coord
PixelCoordinate m_min_coord
Definition:
PixelRectangle.h:52
SourceXtractor::PixelRectangle::getTopLeft
PixelCoordinate getTopLeft() const
Definition:
PixelRectangle.h:29
SourceXtractor::PixelRectangle::PixelRectangle
PixelRectangle()
Definition:
PixelRectangle.h:18
SourceXtractor::PixelRectangle::getBottomRight
PixelCoordinate getBottomRight() const
Definition:
PixelRectangle.h:34
SourceXtractor::PixelRectangle::getWidth
int getWidth() const
Definition:
PixelRectangle.h:39
SourceXtractor::PixelRectangle::PixelRectangle
PixelRectangle(PixelCoordinate min_coord, PixelCoordinate max_coord)
Definition:
PixelRectangle.h:24
SourceXtractor::PixelRectangle::PixelRectangle
PixelRectangle(const PixelRectangle &rectangle)
Definition:
PixelRectangle.h:21
SourceXtractor::PixelRectangle::getHeight
int getHeight() const
Definition:
PixelRectangle.h:45
SourceXtractor
Definition:
Aperture.h:30
SourceXtractor::PixelCoordinate
A pixel coordinate made of two integers m_x and m_y.
Definition:
PixelCoordinate.h:37
SourceXtractor::PixelCoordinate::m_y
int m_y
Definition:
PixelCoordinate.h:38
SourceXtractor::PixelCoordinate::m_x
int m_x
Definition:
PixelCoordinate.h:38
Generated by
1.9.1