Point Cloud Library (PCL)
1.7.0
Main Page
Modules
Namespaces
Classes
registration
include
pcl
registration
correspondence_sorting.h
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2010, Willow Garage, Inc.
6
* Copyright (c) 2012-, Open Perception, Inc.
7
*
8
* All rights reserved.
9
*
10
* Redistribution and use in source and binary forms, with or without
11
* modification, are permitted provided that the following conditions
12
* are met:
13
*
14
* * Redistributions of source code must retain the above copyright
15
* notice, this list of conditions and the following disclaimer.
16
* * Redistributions in binary form must reproduce the above
17
* copyright notice, this list of conditions and the following
18
* disclaimer in the documentation and/or other materials provided
19
* with the distribution.
20
* * Neither the name of the copyright holder(s) nor the names of its
21
* contributors may be used to endorse or promote products derived
22
* from this software without specific prior written permission.
23
*
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
* POSSIBILITY OF SUCH DAMAGE.
36
*
37
* $Id$
38
*
39
*/
40
#ifndef PCL_REGISTRATION_CORRESPONDENCE_SORTING_H_
41
#define PCL_REGISTRATION_CORRESPONDENCE_SORTING_H_
42
43
#if defined __GNUC__
44
# pragma GCC system_header
45
#endif
46
47
#include <pcl/registration/correspondence_types.h>
48
49
namespace
pcl
50
{
51
namespace
registration
52
{
53
/** @b sortCorrespondencesByQueryIndex : a functor for sorting correspondences by query index
54
* \author Dirk Holz
55
* \ingroup registration
56
*/
57
struct
sortCorrespondencesByQueryIndex
:
public
std::binary_function<pcl::Correspondence, pcl::Correspondence, bool>
58
{
59
bool
60
operator()
(
pcl::Correspondence
a,
pcl::Correspondence
b)
61
{
62
return
(a.
index_query
< b.
index_query
);
63
}
64
};
65
66
/** @b sortCorrespondencesByMatchIndex : a functor for sorting correspondences by match index
67
* \author Dirk Holz
68
* \ingroup registration
69
*/
70
struct
sortCorrespondencesByMatchIndex
:
public
std::binary_function<pcl::Correspondence, pcl::Correspondence, bool>
71
{
72
bool
73
operator()
(
pcl::Correspondence
a,
pcl::Correspondence
b)
74
{
75
return
(a.
index_match
< b.
index_match
);
76
}
77
};
78
79
/** @b sortCorrespondencesByDistance : a functor for sorting correspondences by distance
80
* \author Dirk Holz
81
* \ingroup registration
82
*/
83
struct
sortCorrespondencesByDistance
:
public
std::binary_function<pcl::Correspondence, pcl::Correspondence, bool>
84
{
85
bool
86
operator()
(
pcl::Correspondence
a,
pcl::Correspondence
b)
87
{
88
return
(a.
distance
< b.
distance
);
89
}
90
};
91
92
/** @b sortCorrespondencesByQueryIndexAndDistance : a functor for sorting correspondences by query index _and_ distance
93
* \author Dirk Holz
94
* \ingroup registration
95
*/
96
struct
sortCorrespondencesByQueryIndexAndDistance
:
public
std::binary_function<pcl::Correspondence, pcl::Correspondence, bool>
97
{
98
inline
bool
99
operator()
(
pcl::Correspondence
a,
pcl::Correspondence
b)
100
{
101
if
(a.
index_query
< b.
index_query
)
102
return
(
true
);
103
else
if
( (a.
index_query
== b.
index_query
) && (a.
distance
< b.
distance
) )
104
return
(
true
);
105
return
(
false
);
106
}
107
};
108
109
/** @b sortCorrespondencesByMatchIndexAndDistance : a functor for sorting correspondences by match index _and_ distance
110
* \author Dirk Holz
111
* \ingroup registration
112
*/
113
struct
sortCorrespondencesByMatchIndexAndDistance
:
public
std::binary_function<pcl::Correspondence, pcl::Correspondence, bool>
114
{
115
inline
bool
116
operator()
(
pcl::Correspondence
a,
pcl::Correspondence
b)
117
{
118
if
(a.
index_match
< b.
index_match
)
119
return
(
true
);
120
else
if
( (a.
index_match
== b.
index_match
) && (a.
distance
< b.
distance
) )
121
return
(
true
);
122
return
(
false
);
123
}
124
};
125
126
}
127
}
128
129
#endif
/* PCL_REGISTRATION_CORRESPONDENCE_SORTING_H_ */