Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
correspondence.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2011, Willow Garage, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of Willow Garage, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * $Id: correspondence.h 5295 2012-03-25 19:03:32Z rusu $
37  */
38 #ifndef PCL_COMMON_CORRESPONDENCE_H_
39 #define PCL_COMMON_CORRESPONDENCE_H_
40 
41 #include <boost/shared_ptr.hpp>
42 #include <pcl/common/eigen.h>
43 #include <vector>
44 
45 namespace pcl
46 {
54  {
60  union
61  {
62  float distance;
63  float weight;
64  };
65 
69  inline Correspondence () : index_query (0), index_match (-1),
70  distance (std::numeric_limits<float>::max ())
71  {}
72 
74  inline Correspondence (int _index_query, int _index_match, float _distance) :
75  index_query (_index_query), index_match (_index_match), distance (_distance)
76  {}
77 
79  virtual ~Correspondence () {}
80 
81  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
82  };
83 
85  inline std::ostream&
86  operator << (std::ostream& os, const Correspondence& c)
87  {
88  os << c.index_query << " " << c.index_match << " " << c.distance;
89  return (os);
90  }
91 
92  typedef std::vector< pcl::Correspondence, Eigen::aligned_allocator<pcl::Correspondence> > Correspondences;
93  typedef boost::shared_ptr<Correspondences> CorrespondencesPtr;
94  typedef boost::shared_ptr<const Correspondences > CorrespondencesConstPtr;
95 
109  void
110  getRejectedQueryIndices (const pcl::Correspondences &correspondences_before,
111  const pcl::Correspondences &correspondences_after,
112  std::vector<int>& indices,
113  bool presorting_required = true);
114 
121  {
122  Eigen::Vector3f point1;
123  Eigen::Vector3f point2;
124 
127 
130 
131  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
132  };
133  typedef std::vector<PointCorrespondence3D, Eigen::aligned_allocator<PointCorrespondence3D> > PointCorrespondences3DVector;
134 
141  {
142  Eigen::Affine3f transformation;
143 
146 
147  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
148  };
149  typedef std::vector<PointCorrespondence6D, Eigen::aligned_allocator<PointCorrespondence6D> > PointCorrespondences6DVector;
150 
156  inline bool
158  {
159  return (pc1.distance > pc2.distance);
160  }
161 }
162 
163 #endif /* PCL_COMMON_CORRESPONDENCE_H_ */