Point Cloud Library (PCL)
1.7.0
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2010, Willow Garage, Inc. 00006 * Copyright (c) 2012-, Open Perception, Inc. 00007 * 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 00014 * * Redistributions of source code must retain the above copyright 00015 * notice, this list of conditions and the following disclaimer. 00016 * * Redistributions in binary form must reproduce the above 00017 * copyright notice, this list of conditions and the following 00018 * disclaimer in the documentation and/or other materials provided 00019 * with the distribution. 00020 * * Neither the name of the copyright holder(s) nor the names of its 00021 * contributors may be used to endorse or promote products derived 00022 * from this software without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00025 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00026 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00027 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00028 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00029 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00030 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00031 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00032 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00033 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00034 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00035 * POSSIBILITY OF SUCH DAMAGE. 00036 * 00037 * $Id$ 00038 * 00039 */ 00040 #ifndef PCL_REGISTRATION_CORRESPONDENCE_SORTING_H_ 00041 #define PCL_REGISTRATION_CORRESPONDENCE_SORTING_H_ 00042 00043 #if defined __GNUC__ 00044 # pragma GCC system_header 00045 #endif 00046 00047 #include <pcl/registration/correspondence_types.h> 00048 00049 namespace pcl 00050 { 00051 namespace registration 00052 { 00053 /** @b sortCorrespondencesByQueryIndex : a functor for sorting correspondences by query index 00054 * \author Dirk Holz 00055 * \ingroup registration 00056 */ 00057 struct sortCorrespondencesByQueryIndex : public std::binary_function<pcl::Correspondence, pcl::Correspondence, bool> 00058 { 00059 bool 00060 operator()( pcl::Correspondence a, pcl::Correspondence b) 00061 { 00062 return (a.index_query < b.index_query); 00063 } 00064 }; 00065 00066 /** @b sortCorrespondencesByMatchIndex : a functor for sorting correspondences by match index 00067 * \author Dirk Holz 00068 * \ingroup registration 00069 */ 00070 struct sortCorrespondencesByMatchIndex : public std::binary_function<pcl::Correspondence, pcl::Correspondence, bool> 00071 { 00072 bool 00073 operator()( pcl::Correspondence a, pcl::Correspondence b) 00074 { 00075 return (a.index_match < b.index_match); 00076 } 00077 }; 00078 00079 /** @b sortCorrespondencesByDistance : a functor for sorting correspondences by distance 00080 * \author Dirk Holz 00081 * \ingroup registration 00082 */ 00083 struct sortCorrespondencesByDistance : public std::binary_function<pcl::Correspondence, pcl::Correspondence, bool> 00084 { 00085 bool 00086 operator()( pcl::Correspondence a, pcl::Correspondence b) 00087 { 00088 return (a.distance < b.distance); 00089 } 00090 }; 00091 00092 /** @b sortCorrespondencesByQueryIndexAndDistance : a functor for sorting correspondences by query index _and_ distance 00093 * \author Dirk Holz 00094 * \ingroup registration 00095 */ 00096 struct sortCorrespondencesByQueryIndexAndDistance : public std::binary_function<pcl::Correspondence, pcl::Correspondence, bool> 00097 { 00098 inline bool 00099 operator()( pcl::Correspondence a, pcl::Correspondence b) 00100 { 00101 if (a.index_query < b.index_query) 00102 return (true); 00103 else if ( (a.index_query == b.index_query) && (a.distance < b.distance) ) 00104 return (true); 00105 return (false); 00106 } 00107 }; 00108 00109 /** @b sortCorrespondencesByMatchIndexAndDistance : a functor for sorting correspondences by match index _and_ distance 00110 * \author Dirk Holz 00111 * \ingroup registration 00112 */ 00113 struct sortCorrespondencesByMatchIndexAndDistance : public std::binary_function<pcl::Correspondence, pcl::Correspondence, bool> 00114 { 00115 inline bool 00116 operator()( pcl::Correspondence a, pcl::Correspondence b) 00117 { 00118 if (a.index_match < b.index_match) 00119 return (true); 00120 else if ( (a.index_match == b.index_match) && (a.distance < b.distance) ) 00121 return (true); 00122 return (false); 00123 } 00124 }; 00125 00126 } 00127 } 00128 00129 #endif /* PCL_REGISTRATION_CORRESPONDENCE_SORTING_H_ */