diff --git a/common/include/pcl/range_image/impl/range_image.hpp b/common/include/pcl/range_image/impl/range_image.hpp index 01e396e290e..d4f6ec794ed 100644 --- a/common/include/pcl/range_image/impl/range_image.hpp +++ b/common/include/pcl/range_image/impl/range_image.hpp @@ -470,7 +470,7 @@ RangeImage::isValid (int index) const bool RangeImage::isObserved (int x, int y) const { - return !(!isInImage (x,y) || (std::isinf (getPoint (x,y).range) && getPoint (x,y).range < 0.0f)); + return (isInImage (x,y) && (!std::isinf (getPoint (x,y).range) || getPoint (x,y).range >= 0.0f)); } ///////////////////////////////////////////////////////////////////////// diff --git a/features/include/pcl/features/impl/range_image_border_extractor.hpp b/features/include/pcl/features/impl/range_image_border_extractor.hpp index 092dbd3c09c..6ca506ecab4 100644 --- a/features/include/pcl/features/impl/range_image_border_extractor.hpp +++ b/features/include/pcl/features/impl/range_image_border_extractor.hpp @@ -334,7 +334,7 @@ bool RangeImageBorderExtractor::calculateMainPrincipalCurvature(int x, int y, in bool& beam_valid = beams_valid[beam_idx++]; if (step==1) { - beam_valid = !(x2==x && y2==y); + beam_valid = (x2!=x || y2!=y); } else if (!beam_valid) diff --git a/geometry/include/pcl/geometry/mesh_base.h b/geometry/include/pcl/geometry/mesh_base.h index f0437d2d5d3..20003ce49d6 100644 --- a/geometry/include/pcl/geometry/mesh_base.h +++ b/geometry/include/pcl/geometry/mesh_base.h @@ -1333,7 +1333,7 @@ class MeshBase { HalfEdgeIndex& /*idx_free_half_edge*/, std::true_type /*is_manifold*/) const { - return !(is_new_ab && is_new_bc && !is_isolated_b); + return (!is_new_ab || !is_new_bc || is_isolated_b); } /** \brief Check if the half-edge bc is the next half-edge of ab. diff --git a/keypoints/src/brisk_2d.cpp b/keypoints/src/brisk_2d.cpp index 4b3d52c9031..3c58354f6d8 100644 --- a/keypoints/src/brisk_2d.cpp +++ b/keypoints/src/brisk_2d.cpp @@ -1192,7 +1192,7 @@ pcl::keypoints::brisk::ScaleSpace::subpixel2D ( return (static_cast(coeff6) / 18.0f); } - if (!(H_det > 0 && coeff1 < 0)) + if (H_det <= 0 || coeff1 >= 0) { // The maximum must be at the one of the 4 patch corners. int tmp_max = coeff3 + coeff4 + coeff5; diff --git a/octree/include/pcl/octree/impl/octree_search.hpp b/octree/include/pcl/octree/impl/octree_search.hpp index ea89c3d66f1..31a846568f5 100644 --- a/octree/include/pcl/octree/impl/octree_search.hpp +++ b/octree/include/pcl/octree/impl/octree_search.hpp @@ -557,9 +557,9 @@ OctreePointCloudSearch::boxSearchRecur // test if search region overlap with voxel space - if (!((lower_voxel_corner(0) > max_pt(0)) || (min_pt(0) > upper_voxel_corner(0)) || - (lower_voxel_corner(1) > max_pt(1)) || (min_pt(1) > upper_voxel_corner(1)) || - (lower_voxel_corner(2) > max_pt(2)) || (min_pt(2) > upper_voxel_corner(2)))) { + if ((lower_voxel_corner(0) <= max_pt(0)) && (min_pt(0) <= upper_voxel_corner(0)) && + (lower_voxel_corner(1) <= max_pt(1)) && (min_pt(1) <= upper_voxel_corner(1)) && + (lower_voxel_corner(2) <= max_pt(2)) && (min_pt(2) <= upper_voxel_corner(2))) { if (child_node->getNodeType() == BRANCH_NODE) { // we have not reached maximum tree depth diff --git a/recognition/include/pcl/recognition/ransac_based/bvh.h b/recognition/include/pcl/recognition/ransac_based/bvh.h index 1ca6ef3448e..43276a248c7 100644 --- a/recognition/include/pcl/recognition/ransac_based/bvh.h +++ b/recognition/include/pcl/recognition/ransac_based/bvh.h @@ -190,8 +190,8 @@ namespace pcl inline bool intersect(const float box[6]) const { - return !(box[1] < bounds_[0] || box[3] < bounds_[2] || box[5] < bounds_[4] || - box[0] > bounds_[1] || box[2] > bounds_[3] || box[4] > bounds_[5]); + return (box[1] >= bounds_[0] && box[3] >= bounds_[2] && box[5] >= bounds_[4] && + box[0] <= bounds_[1] && box[2] <= bounds_[3] && box[4] <= bounds_[5]); } /** \brief Computes and returns the volume of the bounding box of this node. */ diff --git a/registration/include/pcl/registration/impl/ndt.hpp b/registration/include/pcl/registration/impl/ndt.hpp index 15ac5d68e4b..b6df6802115 100644 --- a/registration/include/pcl/registration/impl/ndt.hpp +++ b/registration/include/pcl/registration/impl/ndt.hpp @@ -730,8 +730,8 @@ NormalDistributionsTransform::computeStepLengt // the sufficient decrease, Equation 1.1, and curvature condition, Equation 1.2 [More, // Thuente 1994] while (!interval_converged && step_iterations < max_step_iterations && - !(psi_t <= 0 /*Sufficient Decrease*/ && - d_phi_t <= -nu * d_phi_0 /*Curvature Condition*/)) { + (psi_t > 0 /*Sufficient Decrease*/ || + d_phi_t > -nu * d_phi_0 /*Curvature Condition*/)) { // Use auxiliary function if interval I is not closed if (open_interval) { a_t = trialValueSelectionMT(a_l, f_l, g_l, a_u, f_u, g_u, a_t, psi_t, d_psi_t); diff --git a/segmentation/include/pcl/segmentation/plane_refinement_comparator.h b/segmentation/include/pcl/segmentation/plane_refinement_comparator.h index ea0699302a9..d22a3ab6eac 100644 --- a/segmentation/include/pcl/segmentation/plane_refinement_comparator.h +++ b/segmentation/include/pcl/segmentation/plane_refinement_comparator.h @@ -177,7 +177,7 @@ namespace pcl int current_label = (*labels_)[idx1].label; int next_label = (*labels_)[idx2].label; - if (!((*refine_labels_)[current_label] && !(*refine_labels_)[next_label])) + if (!(*refine_labels_)[current_label] || (*refine_labels_)[next_label]) return (false); const pcl::ModelCoefficients& model_coeff = (*models_)[(*label_to_model_)[current_label]]; diff --git a/surface/include/pcl/surface/impl/convex_hull.hpp b/surface/include/pcl/surface/impl/convex_hull.hpp index 47d7e80d82c..d17f47b9d11 100644 --- a/surface/include/pcl/surface/impl/convex_hull.hpp +++ b/surface/include/pcl/surface/impl/convex_hull.hpp @@ -85,13 +85,12 @@ pcl::ConvexHull::performReconstruction2D (PointCloud &hull, std::vecto PointInT p0 = (*input_)[(*indices_)[0]]; PointInT p1 = (*input_)[(*indices_)[indices_->size () - 1]]; PointInT p2 = (*input_)[(*indices_)[indices_->size () / 2]]; - Eigen::Array4f dy1dy2 = (p1.getArray4fMap () - p0.getArray4fMap ()) / (p2.getArray4fMap () - p0.getArray4fMap ()); - while (!( (dy1dy2[0] != dy1dy2[1]) || (dy1dy2[2] != dy1dy2[1]) ) ) + while (!pcl::isXYZFinite(p0) || !pcl::isXYZFinite(p1) || !pcl::isXYZFinite(p2) || + (p1.getVector3fMap() - p0.getVector3fMap()).cross(p2.getVector3fMap() - p0.getVector3fMap()).stableNorm() < Eigen::NumTraits::dummy_precision ()) { p0 = (*input_)[(*indices_)[rand () % indices_->size ()]]; p1 = (*input_)[(*indices_)[rand () % indices_->size ()]]; p2 = (*input_)[(*indices_)[rand () % indices_->size ()]]; - dy1dy2 = (p1.getArray4fMap () - p0.getArray4fMap ()) / (p2.getArray4fMap () - p0.getArray4fMap ()); } pcl::PointCloud normal_calc_cloud; diff --git a/surface/include/pcl/surface/impl/gp3.hpp b/surface/include/pcl/surface/impl/gp3.hpp index 5f6c4bd449e..e93b92b3eb3 100644 --- a/surface/include/pcl/surface/impl/gp3.hpp +++ b/surface/include/pcl/surface/impl/gp3.hpp @@ -667,7 +667,7 @@ pcl::GreedyProjectionTriangulation::reconstructPolygons (std::vector

void pcl::MarchingCubes::performReconstruction (pcl::PointCloud &points, std::vector &polygons) { - if (!(iso_level_ >= 0 && iso_level_ < 1)) + if (iso_level_ < 0 || iso_level_ >= 1) { PCL_ERROR ("[pcl::%s::performReconstruction] Invalid iso level %f! Please use a number between 0 and 1.\n", getClassName ().c_str (), iso_level_); diff --git a/test/outofcore/test_outofcore.cpp b/test/outofcore/test_outofcore.cpp index 4dabdbb3aed..1d75415322a 100644 --- a/test/outofcore/test_outofcore.cpp +++ b/test/outofcore/test_outofcore.cpp @@ -99,7 +99,7 @@ AlignedPointTVector points; bool compPt (const PointT &p1, const PointT &p2) { - return !(p1.x != p2.x || p1.y != p2.y || p1.z != p2.z); + return (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z); } TEST (PCL, Outofcore_Octree_Build)