Visual Servoing Platform  version 3.2.0 under development (2019-01-22)
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 
57  vpRectOriented(const vpImagePoint &center, const double width, const double height, const double theta = 0);
58 
59  vpRectOriented(const vpRect &rect);
60 
61  vpRectOriented &operator=(const vpRectOriented &rect);
62 
63  vpRectOriented &operator=(const vpRect &rect);
64 
65  operator vpRect();
66 
67  void setCenter(const vpImagePoint &center);
68 
69  void setPoints(const vpImagePoint &topLeft, const vpImagePoint &topRight, const vpImagePoint &bottomLeft,
70  const vpImagePoint &bottomRight);
71 
72  vpImagePoint getCenter() const;
73 
74  vpImagePoint getTopLeft() const;
75 
76  vpImagePoint getTopRight() const;
77 
78  vpImagePoint getBottomLeft() const;
79 
80  vpImagePoint getBottomRight() const;
81 
82  void setSize(double width, double height);
83 
84  double getWidth() const;
85 
86  double getHeight() const;
87 
88  void setOrientation(double theta);
89 
90  double getOrientation() const;
91 
92  bool isInside(const vpImagePoint &point) const;
93 
94 private:
95  vpImagePoint m_center;
96  double m_width;
97  double m_height;
98  double m_theta;
99  vpImagePoint m_topLeft;
100  vpImagePoint m_topRight;
101  vpImagePoint m_bottomLeft;
102  vpImagePoint m_bottomRight;
103  bool isLeft(const vpImagePoint &pointToTest, const vpImagePoint &point1, const vpImagePoint &point2) const;
104 };
105 #endif // vpRectOriented_h
Defines a rectangle in the plane.
Definition: vpRect.h:78
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:88
Defines an oriented rectangle in the plane.