41 #ifndef PCL_FEATURES_IMPL_BOUNDARY_H_
42 #define PCL_FEATURES_IMPL_BOUNDARY_H_
44 #include <pcl/features/boundary.h>
48 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
bool
51 const std::vector<int> &indices,
52 const Eigen::Vector4f &u,
const Eigen::Vector4f &v,
53 const float angle_threshold)
55 return (isBoundaryPoint (cloud, cloud.
points[q_idx], indices, u, v, angle_threshold));
59 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
bool
62 const std::vector<int> &indices,
63 const Eigen::Vector4f &u,
const Eigen::Vector4f &v,
64 const float angle_threshold)
66 if (indices.size () < 3)
69 if (!std::isfinite (q_point.x) || !std::isfinite (q_point.y) || !std::isfinite (q_point.z))
73 std::vector<float> angles (indices.size ());
74 float max_dif = FLT_MIN, dif;
77 for (
const int &index : indices)
79 if (!std::isfinite (cloud.
points[index].x) ||
80 !std::isfinite (cloud.
points[index].y) ||
81 !std::isfinite (cloud.
points[index].z))
84 Eigen::Vector4f delta = cloud.
points[index].getVector4fMap () - q_point.getVector4fMap ();
85 if (delta == Eigen::Vector4f::Zero())
88 angles[cp++] = std::atan2 (v.dot (delta), u.dot (delta));
94 std::sort (angles.begin (), angles.end ());
97 for (std::size_t i = 0; i < angles.size () - 1; ++i)
99 dif = angles[i + 1] - angles[i];
104 dif = 2 *
static_cast<float> (M_PI) - angles[angles.size () - 1] + angles[0];
109 return (max_dif > angle_threshold);
113 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
void
118 std::vector<int> nn_indices (k_);
119 std::vector<float> nn_dists (k_);
121 Eigen::Vector4f u = Eigen::Vector4f::Zero (), v = Eigen::Vector4f::Zero ();
123 output.is_dense =
true;
125 if (input_->is_dense)
128 for (std::size_t idx = 0; idx < indices_->size (); ++idx)
130 if (this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0)
132 output.points[idx].boundary_point = std::numeric_limits<std::uint8_t>::quiet_NaN ();
133 output.is_dense =
false;
140 getCoordinateSystemOnPlane (normals_->points[(*indices_)[idx]], u, v);
143 output.points[idx].boundary_point = isBoundaryPoint (*surface_, input_->points[(*indices_)[idx]], nn_indices, u, v, angle_threshold_);
149 for (std::size_t idx = 0; idx < indices_->size (); ++idx)
151 if (!
isFinite ((*input_)[(*indices_)[idx]]) ||
152 this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0)
154 output.points[idx].boundary_point = std::numeric_limits<std::uint8_t>::quiet_NaN ();
155 output.is_dense =
false;
162 getCoordinateSystemOnPlane (normals_->points[(*indices_)[idx]], u, v);
165 output.points[idx].boundary_point = isBoundaryPoint (*surface_, input_->points[(*indices_)[idx]], nn_indices, u, v, angle_threshold_);
170 #define PCL_INSTANTIATE_BoundaryEstimation(PointInT,PointNT,PointOutT) template class PCL_EXPORTS pcl::BoundaryEstimation<PointInT, PointNT, PointOutT>;
172 #endif // PCL_FEATURES_IMPL_BOUNDARY_H_