point_tests.h
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2012-, Open Perception, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the copyright holder(s) nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* $Id: point_types.hpp 6415 2012-07-16 20:11:47Z rusu $
*
*/
#pragma once
#include <pcl/point_types.h>
#ifdef _MSC_VER
#include <Eigen/src/StlSupport/details.h>
#endif
namespace pcl
{
/** Tests if the 3D components of a point are all finite
* param[in] pt point to be tested
* return true if finite, false otherwise
*/
template <typename PointT> inline bool
isFinite (const PointT &pt)
{
return (std::isfinite (pt.x) && std::isfinite (pt.y) && std::isfinite (pt.z));
}
#ifdef _MSC_VER
template <typename PointT> inline bool
isFinite (const Eigen::internal::workaround_msvc_stl_support<PointT> &pt)
{
return isFinite<PointT> (static_cast<const PointT&> (pt));
}
#endif
template<> inline bool isFinite<pcl::Axis>(const pcl::Axis&) { return (true); }
template<> inline bool isFinite<pcl::BRISKSignature512>(const pcl::BRISKSignature512&) { return (true); }
template<> inline bool isFinite<pcl::BorderDescription>(const pcl::BorderDescription &) { return true; }
template<> inline bool isFinite<pcl::Boundary>(const pcl::Boundary&) { return (true); }
template<> inline bool isFinite<pcl::CPPFSignature>(const pcl::CPPFSignature&) { return (true); }
template<> inline bool isFinite<pcl::ESFSignature640>(const pcl::ESFSignature640&) { return (true); }
template<> inline bool isFinite<pcl::FPFHSignature33>(const pcl::FPFHSignature33&) { return (true); }
template<> inline bool isFinite<pcl::GASDSignature512>(const pcl::GASDSignature512&) { return (true); }
template<> inline bool isFinite<pcl::GASDSignature984>(const pcl::GASDSignature984&) { return (true); }
template<> inline bool isFinite<pcl::GASDSignature7992>(const pcl::GASDSignature7992&) { return (true); }
template<> inline bool isFinite<pcl::GRSDSignature21>(const pcl::GRSDSignature21&) { return (true); }
template<> inline bool isFinite<pcl::Intensity>(const pcl::Intensity&) { return (true); }
template<> inline bool isFinite<pcl::IntensityGradient>(const pcl::IntensityGradient&) { return (true); }
template<> inline bool isFinite<pcl::Label>(const pcl::Label&) { return (true); }
template<> inline bool isFinite<pcl::MomentInvariants>(const pcl::MomentInvariants&) { return (true); }
template<> inline bool isFinite<pcl::NormalBasedSignature12>(const pcl::NormalBasedSignature12&) { return (true); }
template<> inline bool isFinite<pcl::PFHRGBSignature250>(const pcl::PFHRGBSignature250&) { return (true); }
template<> inline bool isFinite<pcl::PFHSignature125>(const pcl::PFHSignature125&) { return (true); }
template<> inline bool isFinite<pcl::PPFRGBSignature>(const pcl::PPFRGBSignature&) { return (true); }
template<> inline bool isFinite<pcl::PPFSignature>(const pcl::PPFSignature& pt)
{
return std::isfinite(pt.f1) && std::isfinite(pt.f2) && std::isfinite(pt.f3) && std::isfinite(pt.f4) && std::isfinite(pt.alpha_m);
}
template<> inline bool isFinite<pcl::PrincipalCurvatures>(const pcl::PrincipalCurvatures&) { return (true); }
template<> inline bool isFinite<pcl::PrincipalRadiiRSD>(const pcl::PrincipalRadiiRSD&) { return (true); }
template<> inline bool isFinite<pcl::RGB>(const pcl::RGB&) { return (true); }
template<> inline bool isFinite<pcl::ReferenceFrame>(const pcl::ReferenceFrame&) { return (true); }
template<> inline bool isFinite<pcl::SHOT1344>(const pcl::SHOT1344&) { return (true); }
template<> inline bool isFinite<pcl::SHOT352>(const pcl::SHOT352&) { return (true); }
template<> inline bool isFinite<pcl::ShapeContext1980>(const pcl::ShapeContext1980&) { return (true); }
template<> inline bool isFinite<pcl::UniqueShapeContext1960>(const pcl::UniqueShapeContext1960&) { return (true); }
template<> inline bool isFinite<pcl::VFHSignature308>(const pcl::VFHSignature308&) { return (true); }
// specification for pcl::PointXY
template <> inline bool
isFinite<pcl::PointXY> (const pcl::PointXY &p)
{
return (std::isfinite (p.x) && std::isfinite (p.y));
}
// specification for pcl::Normal
template <> inline bool
isFinite<pcl::Normal> (const pcl::Normal &n)
{
return (std::isfinite (n.normal_x) && std::isfinite (n.normal_y) && std::isfinite (n.normal_z));
}
// generic fallback cases
template <typename PointT, traits::HasNoXY<PointT> = true> constexpr inline bool
isXYFinite (const PointT&) noexcept
{
return true;
}
template <typename PointT, traits::HasNoXYZ<PointT> = true> constexpr inline bool
isXYZFinite (const PointT&) noexcept
{
return true;
}
template <typename PointT, traits::HasNoNormal<PointT> = true> constexpr inline bool
isNormalFinite (const PointT&) noexcept
{
return true;
}
// special cases for checks
template <typename PointT, traits::HasXY<PointT> = true> inline bool
isXYFinite (const PointT& pt) noexcept
{
return std::isfinite(pt.x) && std::isfinite(pt.y);
}
template <typename PointT, traits::HasXYZ<PointT> = true> inline bool
isXYZFinite (const PointT& pt) noexcept
{
return std::isfinite(pt.x) && std::isfinite(pt.y) && std::isfinite(pt.z);
}
template <typename PointT, traits::HasNormal<PointT> = true> inline bool
isNormalFinite (const PointT& pt) noexcept
{
return std::isfinite(pt.normal_x) && std::isfinite(pt.normal_y) && std::isfinite(pt.normal_z);
}
}
point_types.h
Defines all the PCL implemented PointT point type structures.
pcl
Definition: convolution.h:46
pcl::isFinite
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:55
pcl::isXYFinite
constexpr bool isXYFinite(const PointT &) noexcept
Definition: point_tests.h:119
pcl::isNormalFinite
constexpr bool isNormalFinite(const PointT &) noexcept
Definition: point_tests.h:131
pcl::isXYZFinite
constexpr bool isXYZFinite(const PointT &) noexcept
Definition: point_tests.h:125
pcl::Axis
A point structure representing an Axis using its normal coordinates.
Definition: point_types.hpp:933
pcl::BRISKSignature512
A point structure representing the Binary Robust Invariant Scalable Keypoints (BRISK).
Definition: point_types.hpp:1607
pcl::BorderDescription
A structure to store if a point in a range image lies on a border between an obstacle and the backgro...
Definition: point_types.hpp:1715
pcl::Boundary
A point structure representing a description of whether a point is lying on a surface boundary or not...
Definition: point_types.hpp:1301
pcl::CPPFSignature
A point structure for storing the Point Pair Feature (CPPF) values.
Definition: point_types.hpp:1398
pcl::ESFSignature640
A point structure representing the Ensemble of Shape Functions (ESF).
Definition: point_types.hpp:1625
pcl::FPFHSignature33
A point structure representing the Fast Point Feature Histogram (FPFH).
Definition: point_types.hpp:1565
pcl::GASDSignature512
A point structure representing the Globally Aligned Spatial Distribution (GASD) shape descriptor.
Definition: point_types.hpp:1639
pcl::GASDSignature7992
A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descr...
Definition: point_types.hpp:1667
pcl::GASDSignature984
A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descr...
Definition: point_types.hpp:1653
pcl::GRSDSignature21
A point structure representing the Global Radius-based Surface Descriptor (GRSD).
Definition: point_types.hpp:1593
pcl::IntensityGradient
A point structure representing the intensity gradient of an XYZI point cloud.
Definition: point_types.hpp:1733
pcl::Intensity
A point structure representing the grayscale intensity in single-channel images.
Definition: point_types.hpp:420
pcl::Label
Definition: point_types.hpp:562
pcl::MomentInvariants
A point structure representing the three moment invariants.
Definition: point_types.hpp:1271
pcl::NormalBasedSignature12
A point structure representing the Normal Based Signature for a feature matrix of 4-by-3.
Definition: point_types.hpp:1440
pcl::Normal
A point structure representing normal coordinates and the surface curvature estimate.
Definition: point_types.hpp:900
pcl::PFHRGBSignature250
A point structure representing the Point Feature Histogram with colors (PFHRGB).
Definition: point_types.hpp:1367
pcl::PFHSignature125
A point structure representing the Point Feature Histogram (PFH).
Definition: point_types.hpp:1352
pcl::PPFRGBSignature
A point structure for storing the Point Pair Color Feature (PPFRGB) values.
Definition: point_types.hpp:1418
pcl::PPFSignature
A point structure for storing the Point Pair Feature (PPF) values.
Definition: point_types.hpp:1381
pcl::PPFSignature::f2
float f2
Definition: point_types.hpp:1382
pcl::PPFSignature::f4
float f4
Definition: point_types.hpp:1382
pcl::PPFSignature::alpha_m
float alpha_m
Definition: point_types.hpp:1383
pcl::PPFSignature::f1
float f1
Definition: point_types.hpp:1382
pcl::PPFSignature::f3
float f3
Definition: point_types.hpp:1382
pcl::PointXY
A 2D point structure representing Euclidean xy coordinates.
Definition: point_types.hpp:832
pcl::PointXY::y
float y
Definition: point_types.hpp:834
pcl::PointXY::x
float x
Definition: point_types.hpp:833
pcl::PointXYZRGB
A point structure representing Euclidean xyz coordinates, and the RGB color.
Definition: point_types.hpp:675
pcl::PrincipalCurvatures
A point structure representing the principal curvatures and their magnitudes.
Definition: point_types.hpp:1321
pcl::PrincipalRadiiRSD
A point structure representing the minimum and maximum surface radii (in meters) computed using RSD.
Definition: point_types.hpp:1286
pcl::RGB
A structure representing RGB color information.
Definition: point_types.hpp:392
pcl::ReferenceFrame
Definition: point_types.hpp:1540
pcl::SHOT1344
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape+col...
Definition: point_types.hpp:1499
pcl::SHOT352
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape onl...
Definition: point_types.hpp:1483
pcl::ShapeContext1980
A point structure representing a Shape Context.
Definition: point_types.hpp:1453
pcl::UniqueShapeContext1960
A point structure representing a Unique Shape Context.
Definition: point_types.hpp:1468
pcl::VFHSignature308
A point structure representing the Viewpoint Feature Histogram (VFH).
Definition: point_types.hpp:1579