ViSP  2.8.0
vpRect.cpp
1 /****************************************************************************
2  *
3  * $Id: vpRect.cpp 4056 2013-01-05 13:04:42Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Defines a rectangle in the plane.
36  *
37  * Author:
38  * Fabien Spindler
39  *
40  *****************************************************************************/
41 
49 #include <visp/vpRect.h>
50 #include <visp/vpDebug.h>
51 
60 {
61  this->left = 0;
62  this->top = 0;
63  this->width = 0;
64  this->height = 0;
65 };
66 
73 vpRect::vpRect(double left, double top, double width, double height)
74 {
75  this->left = left;
76  this->top = top;
77  this->width = width;
78  this->height = height;
79 };
80 
87 vpRect::vpRect(const vpImagePoint &topLeft, double width, double height)
88 {
89  this->left = topLeft.get_u();
90  this->top = topLeft.get_v();
91  this->width = width;
92  this->height = height;
93 };
94 
101 vpRect::vpRect(const vpImagePoint &topLeft, const vpImagePoint &bottomRight)
102 {
103  this->left = topLeft.get_u();
104  this->top = topLeft.get_v();
105 
106  setBottom( bottomRight.get_v() );
107  setRight( bottomRight.get_u() );
108 };
109 
116 {
117  this->left = r.left;
118  this->top = r.top;
119  this->width = r.width;
120  this->height = r.height;
121 };
122 
128 {
129  this->left = r.left;
130  this->top = r.top;
131  this->width = r.width;
132  this->height = r.height;
133  return *this;
134 };
double get_v() const
Definition: vpImagePoint.h:250
double get_u() const
Definition: vpImagePoint.h:239
vpRect()
Definition: vpRect.cpp:59
void setRight(double pos)
Definition: vpRect.h:249
Defines a rectangle in the plane.
Definition: vpRect.h:82
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:92
vpRect & operator=(const vpRect &r)
Definition: vpRect.cpp:127
void setBottom(double pos)
Definition: vpRect.h:198