Point Cloud Library (PCL)  1.8.1-dev
point_tests.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2012-, Open Perception, 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 the copyright holder(s) 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: point_types.hpp 6415 2012-07-16 20:11:47Z rusu $
37  *
38  */
39 
40 #ifndef PCL_COMMON_POINT_TESTS_H_
41 #define PCL_COMMON_POINT_TESTS_H_
42 
43 #ifdef _MSC_VER
44 #include <Eigen/src/StlSupport/details.h>
45 #endif
46 
47 namespace pcl
48 {
49  /** Tests if the 3D components of a point are all finite
50  * param[in] pt point to be tested
51  * return true if finite, false otherwise
52  */
53  template <typename PointT> inline bool
54  isFinite (const PointT &pt)
55  {
56  return (pcl_isfinite (pt.x) && pcl_isfinite (pt.y) && pcl_isfinite (pt.z));
57  }
58 
59 #ifdef _MSC_VER
60  template <typename PointT> inline bool
61  isFinite (const Eigen::internal::workaround_msvc_stl_support<PointT> &pt)
62  {
63  return isFinite<PointT> (static_cast<const PointT&> (pt));
64  }
65 #endif
66 
67  template<> inline bool isFinite<pcl::RGB> (const pcl::RGB&) { return (true); }
68  template<> inline bool isFinite<pcl::Label> (const pcl::Label&) { return (true); }
69  template<> inline bool isFinite<pcl::Axis> (const pcl::Axis&) { return (true); }
70  template<> inline bool isFinite<pcl::Intensity> (const pcl::Intensity&) { return (true); }
71  template<> inline bool isFinite<pcl::MomentInvariants> (const pcl::MomentInvariants&) { return (true); }
72  template<> inline bool isFinite<pcl::PrincipalRadiiRSD> (const pcl::PrincipalRadiiRSD&) { return (true); }
73  template<> inline bool isFinite<pcl::Boundary> (const pcl::Boundary&) { return (true); }
74  template<> inline bool isFinite<pcl::PrincipalCurvatures> (const pcl::PrincipalCurvatures&) { return (true); }
75  template<> inline bool isFinite<pcl::SHOT352> (const pcl::SHOT352&) { return (true); }
76  template<> inline bool isFinite<pcl::SHOT1344> (const pcl::SHOT1344&) { return (true); }
77  template<> inline bool isFinite<pcl::ReferenceFrame> (const pcl::ReferenceFrame&) { return (true); }
78  template<> inline bool isFinite<pcl::ShapeContext1980> (const pcl::ShapeContext1980&) { return (true); }
79  template<> inline bool isFinite<pcl::UniqueShapeContext1960> (const pcl::UniqueShapeContext1960&) { return (true); }
80  template<> inline bool isFinite<pcl::PFHSignature125> (const pcl::PFHSignature125&) { return (true); }
81  template<> inline bool isFinite<pcl::PFHRGBSignature250> (const pcl::PFHRGBSignature250&) { return (true); }
82  template<> inline bool isFinite<pcl::PPFSignature> (const pcl::PPFSignature&) { return (true); }
83  template<> inline bool isFinite<pcl::PPFRGBSignature> (const pcl::PPFRGBSignature&) { return (true); }
84  template<> inline bool isFinite<pcl::NormalBasedSignature12> (const pcl::NormalBasedSignature12&) { return (true); }
85  template<> inline bool isFinite<pcl::FPFHSignature33> (const pcl::FPFHSignature33&) { return (true); }
86  template<> inline bool isFinite<pcl::VFHSignature308> (const pcl::VFHSignature308&) { return (true); }
87  template<> inline bool isFinite<pcl::ESFSignature640> (const pcl::ESFSignature640&) { return (true); }
88  template<> inline bool isFinite<pcl::IntensityGradient> (const pcl::IntensityGradient&) { return (true); }
89  template<> inline bool isFinite<pcl::BRISKSignature512> (const pcl::BRISKSignature512&) { return (true); }
90 
91  // specification for pcl::PointXY
92  template <> inline bool
93  isFinite<pcl::PointXY> (const pcl::PointXY &p)
94  {
95  return (pcl_isfinite (p.x) && pcl_isfinite (p.y));
96  }
97 
98  // specification for pcl::BorderDescription
99  template <> inline bool
100  isFinite<pcl::BorderDescription> (const pcl::BorderDescription &p)
101  {
102  return (pcl_isfinite (p.x) && pcl_isfinite (p.y));
103  }
104 
105  // specification for pcl::Normal
106  template <> inline bool
107  isFinite<pcl::Normal> (const pcl::Normal &n)
108  {
109  return (pcl_isfinite (n.normal_x) && pcl_isfinite (n.normal_y) && pcl_isfinite (n.normal_z));
110  }
111 }
112 
113 #endif // PCL_COMMON_POINT_TESTS_H_
114 
A point structure representing normal coordinates and the surface curvature estimate.
A point structure representing a Shape Context.
bool isFinite(const PointT &pt)
Tests if the 3D components of a point are all finite param[in] pt point to be tested return true if f...
Definition: point_tests.h:54
A point structure representing a description of whether a point is lying on a surface boundary or not...
A point structure representing the Normal Based Signature for a feature matrix of 4-by-3...
A point structure representing a Unique Shape Context.
A point structure representing the Binary Robust Invariant Scalable Keypoints (BRISK).
A point structure representing an Axis using its normal coordinates.
A point structure representing the Fast Point Feature Histogram (FPFH).
A 2D point structure representing Euclidean xy coordinates.
A structure representing RGB color information.
A point structure representing the Point Feature Histogram with colors (PFHRGB).
A point structure representing the three moment invariants.
A point structure representing the grayscale intensity in single-channel images.
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape onl...
A structure to store if a point in a range image lies on a border between an obstacle and the backgro...
A point structure representing the intensity gradient of an XYZI point cloud.
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape+col...
A point structure representing the Viewpoint Feature Histogram (VFH).
A point structure representing the minimum and maximum surface radii (in meters) computed using RSD...
A point structure representing Euclidean xyz coordinates, and the RGB color.
A point structure representing the principal curvatures and their magnitudes.
A point structure representing the Point Feature Histogram (PFH).
A point structure representing the Ensemble of Shape Functions (ESF).
A point structure for storing the Point Pair Feature (PPF) values.
A point structure for storing the Point Pair Color Feature (PPFRGB) values.