Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
testRect.cpp
1
/*
2
* ViSP, open source Visual Servoing Platform software.
3
* Copyright (C) 2005 - 2025 by Inria. All rights reserved.
4
*
5
* This software is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
9
* See the file LICENSE.txt at the root directory of this source
10
* distribution for additional information about the GNU GPL.
11
*
12
* For using ViSP with software that can not be combined with the GNU
13
* GPL, please contact Inria about acquiring a ViSP Professional
14
* Edition License.
15
*
16
* See https://visp.inria.fr for more information.
17
*
18
* This software was developed at:
19
* Inria Rennes - Bretagne Atlantique
20
* Campus Universitaire de Beaulieu
21
* 35042 Rennes Cedex
22
* France
23
*
24
* If you have questions regarding the use of this file, please contact
25
* Inria at visp@inria.fr
26
*
27
* This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28
* WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29
*
30
* Description:
31
* Test vpRect.
32
*/
33
37
#include <iostream>
38
#include <visp3/core/vpConfig.h>
39
#include <visp3/core/vpRect.h>
40
41
int
main()
42
{
43
#ifdef ENABLE_VISP_NAMESPACE
44
using namespace
VISP_NAMESPACE_NAME
;
45
#endif
46
vpRect
c(10.1, 15.05, 19.63, 7.84);
47
vpRect
a(c.getLeft() - 12.456, c.getTop() - 7.75, c.getWidth() + 12.456, c.getHeight() + 7.75);
48
vpRect
b(c.getLeft(), c.getTop(), c.getWidth() + 8.81, c.getHeight() + 14.57);
49
50
vpRect
intersect = a & b;
51
52
std::cout <<
"Test intersection."
<< std::endl;
53
std::cout <<
"a="
<< a << std::endl;
54
std::cout <<
"b="
<< b << std::endl;
55
std::cout <<
"c="
<< c << std::endl;
56
std::cout <<
"intersect="
<< intersect << std::endl;
57
58
if
(intersect != c) {
59
std::cerr <<
"Problem with the intersection function!"
<< std::endl;
60
return
EXIT_FAILURE;
61
}
62
63
a &= b;
64
std::cout <<
"a="
<< a << std::endl;
65
66
if
(a != c) {
67
std::cerr <<
"Problem with the intersection function!"
<< std::endl;
68
return
EXIT_FAILURE;
69
}
70
71
a =
vpRect
(11.45, 15.67, 3.5, 7.81);
72
b =
vpRect
(24.78, 31.46, 7.48, 11.28);
73
intersect = a & b;
74
75
std::cout <<
"\nTest no intersection."
<< std::endl;
76
std::cout <<
"a="
<< a << std::endl;
77
std::cout <<
"b="
<< b << std::endl;
78
std::cout <<
"intersect="
<< intersect << std::endl;
79
80
if
(intersect !=
vpRect
()) {
81
std::cerr <<
"Problem with the intersection function!"
<< std::endl;
82
return
EXIT_FAILURE;
83
}
84
85
a &= b;
86
std::cout <<
"a="
<< a << std::endl;
87
88
if
(a !=
vpRect
()) {
89
std::cerr <<
"Problem with the intersection function!"
<< std::endl;
90
return
EXIT_FAILURE;
91
}
92
93
std::cout <<
"vpRect is ok."
<< std::endl;
94
return
EXIT_SUCCESS;
95
}
vpRect
Defines a rectangle in the plane.
Definition
vpRect.h:79
VISP_NAMESPACE_NAME
Definition
vpEigenConversion.h:44
modules
core
test
tools
geometry
testRect.cpp
Generated by
1.17.0