MRPT
2.0.4
mrpt
img
TPixelCoord.h
Go to the documentation of this file.
1
/* +------------------------------------------------------------------------+
2
| Mobile Robot Programming Toolkit (MRPT) |
3
| https://www.mrpt.org/ |
4
| |
5
| Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6
| See: https://www.mrpt.org/Authors - All rights reserved. |
7
| Released under BSD License. See: https://www.mrpt.org/License |
8
+------------------------------------------------------------------------+ */
9
#pragma once
10
11
#include <iosfwd>
12
#include <utility>
13
14
namespace
mrpt::img
15
{
16
/** A pair (x,y) of pixel coordinates (subpixel resolution). \ingroup
17
* mrpt_img_grp */
18
struct
TPixelCoordf
19
{
20
/** The type of \a x and \a y */
21
using
pixel_coord_t
= float;
22
23
float
x
{.0f},
y
{.0f};
24
25
/** Default constructor: undefined values of x,y */
26
TPixelCoordf
() =
default
;
27
/** Constructor from x,y values */
28
TPixelCoordf
(
const
float
_x,
const
float
_y) :
x
(_x),
y
(_y) {}
29
template
<
typename
T>
30
TPixelCoordf
(
const
std::pair<T, T>& p)
31
:
x
(static_cast<float>(p.first)),
y
(static_cast<float>(p.second))
32
{
33
}
34
};
35
36
/** Prints TPixelCoordf as "(x,y)" */
37
std::ostream&
operator<<
(std::ostream& o,
const
TPixelCoordf& p);
38
39
/** A pair (x,y) of pixel coordinates (integer resolution). */
40
struct
TPixelCoord
41
{
42
/** The type of \a x and \a y */
43
using
pixel_coord_t
= int;
44
45
TPixelCoord
() =
default
;
46
TPixelCoord
(
const
int
_x,
const
int
_y) :
x
(_x),
y
(_y) {}
47
inline
bool
operator==
(
const
TPixelCoord
& o)
48
{
49
return
x
== o.
x
&&
y
== o.
y
;
50
}
51
int
x
{0},
y
{0};
52
};
53
54
/** Prints TPixelCoord as "(x,y)" */
55
std::ostream&
operator<<
(std::ostream& o,
const
TPixelCoord& p);
56
57
/** A type for image sizes. */
58
using
TImageSize
=
TPixelCoord
;
59
60
}
// namespace mrpt::img
mrpt::img::TPixelCoord::pixel_coord_t
int pixel_coord_t
The type of x and y.
Definition:
TPixelCoord.h:43
mrpt::img::TPixelCoordf
A pair (x,y) of pixel coordinates (subpixel resolution).
Definition:
TPixelCoord.h:18
mrpt::img::TPixelCoord::TPixelCoord
TPixelCoord()=default
mrpt::img::TPixelCoord::y
int y
Definition:
TPixelCoord.h:51
mrpt::img::TPixelCoord::x
int x
Definition:
TPixelCoord.h:51
mrpt::img::operator<<
std::ostream & operator<<(std::ostream &o, const TColor &c)
Definition:
TColor.cpp:80
mrpt::img::TPixelCoord::TPixelCoord
TPixelCoord(const int _x, const int _y)
Definition:
TPixelCoord.h:46
mrpt::img
Definition:
CCanvas.h:16
mrpt::img::TPixelCoordf::TPixelCoordf
TPixelCoordf(const float _x, const float _y)
Constructor from x,y values.
Definition:
TPixelCoord.h:28
mrpt::img::TPixelCoordf::TPixelCoordf
TPixelCoordf(const std::pair< T, T > &p)
Definition:
TPixelCoord.h:30
mrpt::img::TPixelCoordf::TPixelCoordf
TPixelCoordf()=default
Default constructor: undefined values of x,y.
mrpt::img::TPixelCoordf::y
float y
Definition:
TPixelCoord.h:23
mrpt::img::TPixelCoordf::x
float x
Definition:
TPixelCoord.h:23
mrpt::img::TPixelCoord
A pair (x,y) of pixel coordinates (integer resolution).
Definition:
TPixelCoord.h:40
mrpt::img::TPixelCoord::operator==
bool operator==(const TPixelCoord &o)
Definition:
TPixelCoord.h:47
mrpt::img::TPixelCoordf::pixel_coord_t
float pixel_coord_t
The type of x and y.
Definition:
TPixelCoord.h:21
Page generated by
Doxygen 1.8.17
for MRPT 2.0.4 at Sun Jul 19 17:54:30 UTC 2020