MRPT  1.9.9
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-2019, 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 */
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) : x(p.first), y(p.second)
31  {
32  }
33 };
34 
35 /** Prints TPixelCoordf as "(x,y)" */
36 std::ostream& operator<<(std::ostream& o, const TPixelCoordf& p);
37 
38 /** A pair (x,y) of pixel coordinates (integer resolution). */
40 {
41  /** The type of \a x and \a y */
42  using pixel_coord_t = int;
43 
44  TPixelCoord() = default;
45  TPixelCoord(const int _x, const int _y) : x(_x), y(_y) {}
46  inline bool operator==(const TPixelCoord& o)
47  {
48  return x == o.x && y == o.y;
49  }
50  int x{0}, y{0};
51 };
52 
53 /** Prints TPixelCoord as "(x,y)" */
54 std::ostream& operator<<(std::ostream& o, const TPixelCoord& p);
55 
56 /** A type for image sizes. */
58 
59 } // namespace mrpt::img
float pixel_coord_t
The type of x and y.
Definition: TPixelCoord.h:21
GLint * first
Definition: glext.h:3833
A pair (x,y) of pixel coordinates (subpixel resolution).
Definition: TPixelCoord.h:18
TPixelCoord(const int _x, const int _y)
Definition: TPixelCoord.h:45
TPixelCoordf(const std::pair< T, T > &p)
Definition: TPixelCoord.h:30
A pair (x,y) of pixel coordinates (integer resolution).
Definition: TPixelCoord.h:39
bool operator==(const TPixelCoord &o)
Definition: TPixelCoord.h:46
TPixelCoordf(const float _x, const float _y)
Constructor from x,y values.
Definition: TPixelCoord.h:28
int pixel_coord_t
The type of x and y.
Definition: TPixelCoord.h:42
TPixelCoordf()=default
Default constructor: undefined values of x,y.
GLenum GLint GLint y
Definition: glext.h:3542
GLenum GLint x
Definition: glext.h:3542
std::ostream & operator<<(std::ostream &o, const TColor &c)
Definition: TColor.cpp:76
GLfloat GLfloat p
Definition: glext.h:6398



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019