Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from boost::math::isnan to std::isnan #2819

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/in_hand_scanner/src/icp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ pcl::ihs::ICP::selectDataPoints (const CloudXYZRGBNormalConstPtr& cloud_data) co
CloudXYZRGBNormal::const_iterator it_in = cloud_data->begin ();
for (; it_in!=cloud_data->end (); ++it_in)
{
if (!boost::math::isnan (it_in->x))
if (!std::isnan (it_in->x))
{
PointNormal pt;
pt.getVector4fMap () = it_in->getVector4fMap ();
Expand Down
4 changes: 2 additions & 2 deletions apps/in_hand_scanner/src/input_data_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pcl::ihs::InputDataProcessing::segment (const CloudXYZRGBAConstPtr& cloud_in,

xyz_mask (r, c) = hsv_mask (r, c) = false;

if (!boost::math::isnan (xyzrgb.x) && !boost::math::isnan (normal.normal_x) &&
if (!std::isnan (xyzrgb.x) && !std::isnan (normal.normal_x) &&
xyzrgb.x >= x_min && xyzrgb.x <= x_max &&
xyzrgb.y >= y_min && xyzrgb.y <= y_max &&
xyzrgb.z >= z_min && xyzrgb.z <= z_max)
Expand Down Expand Up @@ -246,7 +246,7 @@ pcl::ihs::InputDataProcessing::calculateNormals (const CloudXYZRGBAConstPtr& clo

for (; it_in!=cloud_in->end (); ++it_in, ++it_n, ++it_out)
{
if (!boost::math::isnan (it_n->getNormalVector4fMap ()))
if (!it_n->getNormalVector4fMap (). hasNaN ())
{
// m -> cm
it_out->getVector4fMap () = 100.f * it_in->getVector4fMap ();
Expand Down
20 changes: 10 additions & 10 deletions apps/in_hand_scanner/src/integration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pcl::ihs::Integration::reconstructMesh (const CloudXYZRGBNormalConstPtr& cloud_d
const PointXYZRGBNormal& pt_d = cloud_data->operator [] (c);
const float weight = -pt_d.normal_z; // weight = -dot (normal, [0; 0; 1])

if (!boost::math::isnan (pt_d.x) && weight > min_weight_)
if (!std::isnan (pt_d.x) && weight > min_weight_)
{
cloud_model->operator [] (c) = PointIHS (pt_d, weight);
}
Expand All @@ -113,7 +113,7 @@ pcl::ihs::Integration::reconstructMesh (const CloudXYZRGBNormalConstPtr& cloud_d
const PointXYZRGBNormal& pt_d = cloud_data->operator [] (r*width + c);
const float weight = -pt_d.normal_z; // weight = -dot (normal, [0; 0; 1])

if (!boost::math::isnan (pt_d.x) && weight > min_weight_)
if (!std::isnan (pt_d.x) && weight > min_weight_)
{
cloud_model->operator [] (r*width + c) = PointIHS (pt_d, weight);
}
Expand Down Expand Up @@ -163,7 +163,7 @@ pcl::ihs::Integration::reconstructMesh (const CloudXYZRGBNormalConstPtr& cloud_d

const float weight = -pt_d_0.normal_z; // weight = -dot (normal, [0; 0; 1])

if (!boost::math::isnan (pt_d_0.x) && weight > min_weight_)
if (!std::isnan (pt_d_0.x) && weight > min_weight_)
{
pt_m_0 = PointIHS (pt_d_0, weight);
}
Expand Down Expand Up @@ -242,7 +242,7 @@ pcl::ihs::Integration::merge (const CloudXYZRGBNormalConstPtr& cloud_data,
const PointXYZRGBNormal& pt_d = cloud_data->operator [] (c);
const float weight = -pt_d.normal_z; // weight = -dot (normal, [0; 0; 1])

if (!boost::math::isnan (pt_d.x) && weight > min_weight_)
if (!std::isnan (pt_d.x) && weight > min_weight_)
{
PointIHS& pt_d_t = cloud_data_transformed->operator [] (c);
pt_d_t = PointIHS (pt_d, weight);
Expand All @@ -257,7 +257,7 @@ pcl::ihs::Integration::merge (const CloudXYZRGBNormalConstPtr& cloud_data,
const PointXYZRGBNormal& pt_d = cloud_data->operator [] (r*width + c);
const float weight = -pt_d.normal_z; // weight = -dot (normal, [0; 0; 1])

if (!boost::math::isnan (pt_d.x) && weight > min_weight_)
if (!std::isnan (pt_d.x) && weight > min_weight_)
{
PointIHS& pt_d_t = cloud_data_transformed->operator [] (r*width + c);
pt_d_t = PointIHS (pt_d, weight);
Expand Down Expand Up @@ -312,7 +312,7 @@ pcl::ihs::Integration::merge (const CloudXYZRGBNormalConstPtr& cloud_data,

const float weight = -pt_d_0.normal_z; // weight = -dot (normal, [0; 0; 1])

if (!boost::math::isnan (pt_d_0.x) && weight > min_weight_)
if (!std::isnan (pt_d_0.x) && weight > min_weight_)
{
pt_d_t_0 = PointIHS (pt_d_0, weight);
pt_d_t_0.getVector4fMap () = T * pt_d_t_0.getVector4fMap ();
Expand Down Expand Up @@ -519,10 +519,10 @@ pcl::ihs::Integration::addToMesh (const PointIHS& pt_0,
// | |
// 3 - 0
const unsigned char is_finite = static_cast <unsigned char> (
(1 * !boost::math::isnan (pt_0.x)) |
(2 * !boost::math::isnan (pt_1.x)) |
(4 * !boost::math::isnan (pt_2.x)) |
(8 * !boost::math::isnan (pt_3.x)));
(1 * !std::isnan (pt_0.x)) |
(2 * !std::isnan (pt_1.x)) |
(4 * !std::isnan (pt_2.x)) |
(8 * !std::isnan (pt_3.x)));

switch (is_finite)
{
Expand Down
6 changes: 3 additions & 3 deletions apps/in_hand_scanner/src/opengl_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,9 +537,9 @@ pcl::ihs::OpenGLViewer::addMesh (const CloudXYZRGBNormalConstPtr& cloud, const s
const PointXYZRGBNormal& pt_2 = cloud->operator [] (ind_o_2);
const PointXYZRGBNormal& pt_3 = cloud->operator [] (ind_o_3);

if (!boost::math::isnan (pt_1.x) && !boost::math::isnan (pt_3.x))
if (!std::isnan (pt_1.x) && !std::isnan (pt_3.x))
{
if (!boost::math::isnan (pt_2.x)) // 1-2-3 is valid
if (!std::isnan (pt_2.x)) // 1-2-3 is valid
{
if (std::abs (pt_1.z - pt_2.z) < 1 &&
std::abs (pt_1.z - pt_3.z) < 1 &&
Expand All @@ -552,7 +552,7 @@ pcl::ihs::OpenGLViewer::addMesh (const CloudXYZRGBNormalConstPtr& cloud, const s
triangles.emplace_back(ind_v_1, ind_v_2, ind_v_3);
}
}
if (!boost::math::isnan (pt_0.x)) // 0-1-3 is valid
if (!std::isnan (pt_0.x)) // 0-1-3 is valid
{
if (std::abs (pt_0.z - pt_1.z) < 1 &&
std::abs (pt_0.z - pt_3.z) < 1 &&
Expand Down
1 change: 0 additions & 1 deletion common/include/pcl/pcl_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ namespace pcl
#endif
#include <cmath>

// MSCV doesn't have std::{isnan,isfinite}
#if defined _WIN32 && defined _MSC_VER

// If M_PI is not defined, then probably all of them are undefined
Expand Down