Visual Servoing Platform version 3.5.0
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
52class VISP_EXPORT vpRectOriented
53{
54public:
56
57 vpRectOriented(const vpImagePoint &center, double width, double height, double theta = 0);
58
59 vpRectOriented(const vpRect &rect);
60
61#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
62 vpRectOriented &operator=(const vpRectOriented &rect) = default;
63#else
64 vpRectOriented &operator=(const vpRectOriented &rect);
65#endif
66
67 vpRectOriented &operator=(const vpRect &rect);
68
69 operator vpRect();
70
71 void setCenter(const vpImagePoint &center);
72
73 void setPoints(const vpImagePoint &topLeft, const vpImagePoint &topRight, const vpImagePoint &bottomLeft,
74 const vpImagePoint &bottomRight);
75
76 vpImagePoint getCenter() const;
77
78 vpImagePoint getTopLeft() const;
79
80 vpImagePoint getTopRight() const;
81
82 vpImagePoint getBottomLeft() const;
83
84 vpImagePoint getBottomRight() const;
85
86 void setSize(double width, double height);
87
88 double getWidth() const;
89
90 double getHeight() const;
91
92 void setOrientation(double theta);
93
94 double getOrientation() const;
95
96 bool isInside(const vpImagePoint &point) const;
97
98private:
99 vpImagePoint m_center;
100 double m_width;
101 double m_height;
102 double m_theta;
103 vpImagePoint m_topLeft;
104 vpImagePoint m_topRight;
105 vpImagePoint m_bottomLeft;
106 vpImagePoint m_bottomRight;
107 bool isLeft(const vpImagePoint &pointToTest, const vpImagePoint &point1, const vpImagePoint &point2) const;
108};
109#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:88
Defines an oriented rectangle in the plane.
vpRectOriented & operator=(const vpRectOriented &rect)=default
Defines a rectangle in the plane.
Definition: vpRect.h:80