Visual Servoing Platform  version 3.5.1 under development (2022-12-04)
vpRectOriented.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Defines a (possibly oriented) rectangle in the plane.
33  *
34  * Author:
35  * Pierre Chatelain
36  * Marc Pouliquen
37  *
38  *****************************************************************************/
39 
40 #ifndef vpRectOriented_h
41 #define vpRectOriented_h
42 
49 #include <visp3/core/vpImagePoint.h>
50 #include <visp3/core/vpRect.h>
51 
52 class VISP_EXPORT vpRectOriented
53 {
54 public:
56 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
57  vpRectOriented(const vpRectOriented &rect) = default;
58 #else
59  vpRectOriented(const vpRectOriented &rect);
60 #endif
61 
62  vpRectOriented(const vpImagePoint &center, double width, double height, double theta = 0);
63 
64  vpRectOriented(const vpRect &rect);
65 
66 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
67  vpRectOriented &operator=(const vpRectOriented &rect) = default;
68 #else
69  vpRectOriented &operator=(const vpRectOriented &rect);
70 #endif
71 
72  vpRectOriented &operator=(const vpRect &rect);
73 
74  operator vpRect();
75 
76  void setCenter(const vpImagePoint &center);
77 
78  void setPoints(const vpImagePoint &topLeft, const vpImagePoint &topRight, const vpImagePoint &bottomLeft,
79  const vpImagePoint &bottomRight);
80 
81  vpImagePoint getCenter() const;
82 
83  vpImagePoint getTopLeft() const;
84 
85  vpImagePoint getTopRight() const;
86 
87  vpImagePoint getBottomLeft() const;
88 
89  vpImagePoint getBottomRight() const;
90 
91  void setSize(double width, double height);
92 
93  double getWidth() const;
94 
95  double getHeight() const;
96 
97  void setOrientation(double theta);
98 
99  double getOrientation() const;
100 
101  bool isInside(const vpImagePoint &point) const;
102 
103 private:
104  vpImagePoint m_center;
105  double m_width;
106  double m_height;
107  double m_theta;
108  vpImagePoint m_topLeft;
109  vpImagePoint m_topRight;
110  vpImagePoint m_bottomLeft;
111  vpImagePoint m_bottomRight;
112  bool isLeft(const vpImagePoint &pointToTest, const vpImagePoint &point1, const vpImagePoint &point2) const;
113 };
114 #endif // vpRectOriented_h
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:89
Defines an oriented rectangle in the plane.
vpRectOriented(const vpRectOriented &rect)=default
vpRectOriented & operator=(const vpRectOriented &rect)=default
Defines a rectangle in the plane.
Definition: vpRect.h:80