This file is indexed.

/usr/include/visp/vpRect.h is in libvisp-dev 2.8.0-4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
/****************************************************************************
 *
 * $Id: vpRect.h 4056 2013-01-05 13:04:42Z fspindle $
 *
 * This file is part of the ViSP software.
 * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
 * 
 * This software is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * ("GPL") version 2 as published by the Free Software Foundation.
 * See the file LICENSE.txt at the root directory of this source
 * distribution for additional information about the GNU GPL.
 *
 * For using ViSP with software that can not be combined with the GNU
 * GPL, please contact INRIA about acquiring a ViSP Professional 
 * Edition License.
 *
 * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
 * 
 * This software was developed at:
 * INRIA Rennes - Bretagne Atlantique
 * Campus Universitaire de Beaulieu
 * 35042 Rennes Cedex
 * France
 * http://www.irisa.fr/lagadic
 *
 * If you have questions regarding the use of this file, please contact
 * INRIA at visp@inria.fr
 * 
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 *
 * Description:
 * Defines a rectangle in the plane.
 *
 * Author:
 * Fabien Spindler
 *
 *****************************************************************************/


#ifndef vpRect_h
#define vpRect_h




/*!
  \class vpRect

  \brief Defines a rectangle in the plane.

  A rectangle is internally represented as an upper-left corner and a
  width and height, but it is normally expressed as an upper-left
  corner and bottom-right corner.

  Note that the size (width and height) of a rectangle might be
  different from what you are used to. If the top-left corner and the
  bottom-right corner are the same, the height and the width of the
  rectangle will both be 1.

  Generally, width = right - left + 1 and height = bottom - top +
  1. We designed it this way to make it correspond to rectangular
  spaces used by drawing functions in which the width and height
  denote a number of pixels. For example, drawing a rectangle with
  width and height 1 draws a single pixel.

  The default coordinate system has origin (0, 0) in the top-left
  corner. The positive direction of the y axis is down, and the
  positive x axis is from left to right.

  A vpRect can be constructed with a set of left, top, width and
  height double. After creation the dimensions can be changed,
  e.g. with setLeft(), setRight(), setTop() and setBottom(), or by
  setting sizes, e.g. setWidth(), setHeight()

*/

#include <visp/vpImagePoint.h>

class VISP_EXPORT vpRect
{
public:

  vpRect();
  vpRect(double left, double top, double width, double height);
  vpRect(const vpImagePoint &topLeft, double width, double height);
  vpRect(const vpImagePoint &topLeft, const vpImagePoint &bottomRight);
  vpRect(const vpRect& r);
  
  vpRect &operator=(const vpRect& r);

  /*!
    Returns the bottom coordinate of the rectangle. 
    \sa getRight()
  */
  inline double getBottom() const { return (this->top + this->height - 1.0); };
  /*!
    Returns the bottom-right coordinate of the rectangle. 
    \sa getTopLeft(), getBottom(), getRight()
  */
  inline vpImagePoint getBottomRight() const {
    vpImagePoint bottomRight;
    bottomRight.set_u( getRight() );
    bottomRight.set_v( getBottom() );

    return bottomRight;
  };
  /*!

    Returns the center point of the rectangle. The center point
    coordinates are (\e x, \e y)

    The default coordinate system has origin (0, 0) in the top-left
    corner. The positive direction of the y axis is down, and the
    positive x axis is from left to right.

    \sa moveCenter()
  */
  inline void getCenter(double & x, double & y) const { 
    x = this->left + this->width  / 2.0 - 0.5; 
    y = this->top  + this->height / 2.0 - 0.5; 
  };
  /*!

    Returns the center point of the rectangle. The center point
    coordinates are (\e x, \e y)

    The default coordinate system has origin (0, 0) in the top-left
    corner. The positive direction of the y axis is down, and the
    positive x axis is from left to right.

    \sa moveCenter()
  */
  inline vpImagePoint getCenter() const { 
    vpImagePoint center;
    center.set_u( this->left + this->width  / 2.0 - 0.5 ); 
    center.set_v( this->top  + this->height / 2.0 - 0.5 ); 
    return center;
  };
  /*!
 
   Returns the height of the rectangle. The height includes both the
   top and bottom edges, i.e. height = bottom - top + 1.

   \sa getWidth()

  */
  inline double getHeight() const { return this->height; };
  /*!
    Returns the left coordinate of the rectangle. 

    \sa getTopLeft(), getRight()
  */
  inline double getLeft() const { return this->left;   };

  /*!
    Returns the right coordinate of the rectangle. 
    \sa getLeft()
  */
  inline double getRight() const { return (this->left + this->width - 1.0); };

  /*!
    Returns the top coordinate of the rectangle. 

    \sa getTopLeft(), getBottom()
  */
  inline double getTop() const { return this->top;  };
  /*!
    Returns the top-left position of the rectangle. 

    \sa getBottomRight(), getTop(), getLeft()
  */
  inline vpImagePoint getTopLeft() const { 
    vpImagePoint topLeft;
    topLeft.set_u( this->left );
    topLeft.set_v( this->top );
    return topLeft; 
  };
  /*!
   Returns the width of the rectangle. The width includes both the
   left and right edges, i.e. width = right - left + 1.
   
   \sa getHeight()

  */
  inline double getWidth() const { return this->width;  };

  /*!

    Sets the bottom edge position of the rectangle to pos. May change
    the height of the rectangle, but will never change the top edge
    position the rectangle.

    \sa setTop()
  */
  inline void setBottom(double pos) { this->height = pos - this->top + 1.0; };
  /*!

    Sets the bottom-right position of the rectangle. Will never change
    the top-left position the rectangle.

    \sa setTopLeft()
  */
  inline void setBottomRight(const vpImagePoint &bottomRight) {
    this->height = bottomRight.get_v() - this->top + 1.0; 
    this->width = bottomRight.get_u() - this->left + 1.0;
  };
  /*!

    Sets the height of the rectangle to \e h. The top edge is not moved,
    but the bottom edge may be moved.

    \sa setWidth()
  */
  inline void setHeight(double h) { this->height = h; };
  /*!

    Sets the left edge position of the rectangle to pos. May change the right
    edge  position of the rectangle, but will never change the width of the
    rectangle.

    \sa setRight()

  */
  inline void setLeft(double pos) { this->left = pos; };
  /*!

    Sets the coordinates of the rectangle's top left corner to
    (left, top), and its size to (width, height).

  */
  inline void setRect(double left, double top, double width, double height) {
     this->left   = left; 
     this->top    = top; 
     this->width  = width;
     this->height = height;
  };
  /*!

    Sets the right edge position of the rectangle to pos. May change
    the width of the rectangle, but will never change the left edge
    position of the rectangle.

    \sa setLeft()

  */
  inline void setRight(double pos) { this->width = pos - this->left + 1.0; };
  /*!

    Sets the top edge position of the rectangle to pos. May change the bottom
    edge position of the rectangle, but will never change the height of the
    rectangle.

    \sa setBottom()
  */
  inline void setTop(double pos) { this->top = pos; };
  /*!

    Sets the top-left position of the rectangle. May change the bottom
    edge position of the rectangle, but will never change the height of the
    rectangle.

    \sa setBottomRight()
  */
  inline void setTopLeft(const vpImagePoint &topLeft) { 
    this->left = topLeft.get_u(); 
    this->top  = topLeft.get_v(); 
  };
  /*!

    Sets the width of the rectangle to \e w. The right edge is changed,
    but not the left edge.

    \sa setHeight()
  */
  inline void setWidth(double w) { this->width = w; }
 
  /*!

    Sets the center point of the rectangle to (\e x, \e y), leaving
    the size unchanged.

    \sa getCenter()

  */
  inline void moveCenter(double x, double y) {
    this->left = x - this->width/2  + 0.5;
    this->top  = y - this->height/2 + 0.5;
  };
  
private:
  double left;   // Upper left corner position along the columns axis
  double top;    // Upper left corner position along the rows axis
  double width;  // Rectangle width
  double height; // Rectangle height
};


/*!

  Check if an image point belongs to a rectangle.
  
  \param ip : the image point.
  \param rect : the rectangle.
  
  \return Returns true if the point belongs to the rectangle.

*/
VISP_EXPORT inline bool inRectangle( const vpImagePoint &ip, const vpRect &rect ) {
  return ( ip.get_i() <= rect.getBottom() && ip.get_i() >= rect.getTop() && ip.get_j() <= rect.getRight() && ip.get_j() >= rect.getLeft());
}


#endif