40 #ifndef PCL_FEATURES_IMPL_BOUNDARY_H_
41 #define PCL_FEATURES_IMPL_BOUNDARY_H_
47 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
bool
50 const std::vector<int> &indices,
51 const Eigen::Vector4f &u,
const Eigen::Vector4f &v,
52 const float angle_threshold)
54 return (isBoundaryPoint (cloud, cloud.
points[q_idx], indices, u, v, angle_threshold));
58 template <
typename Po
intInT,
typename Po
intNT,
typename Po
intOutT>
bool
61 const std::vector<int> &indices,
62 const Eigen::Vector4f &u,
const Eigen::Vector4f &v,
63 const float angle_threshold)
65 if (indices.size () < 3)
72 std::vector<float> angles (indices.size ());
73 float max_dif = FLT_MIN, dif;
76 for (
size_t i = 0; i < indices.size (); ++i)
83 Eigen::Vector4f delta = cloud.
points[indices[i]].getVector4fMap () - q_point.getVector4fMap ();
85 angles[cp++] = atan2f (v.dot (delta), u.dot (delta));
91 std::sort (angles.begin (), angles.end ());
94 for (
size_t i = 0; i < angles.size () - 1; ++i)
96 dif = angles[i + 1] - angles[i];
101 dif = 2 *
static_cast<float> (M_PI) - angles[angles.size () - 1] + angles[0];
106 if (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 (
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<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 (
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<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_);
171 template <
typename Po
intInT,
typename Po
intNT>
void
176 std::vector<int> nn_indices (k_);
177 std::vector<float> nn_dists (k_);
179 Eigen::Vector4f u = Eigen::Vector4f::Zero (), v = Eigen::Vector4f::Zero ();
182 output.
points.resize (indices_->size (), 1);
184 if (input_->is_dense)
187 for (
size_t idx = 0; idx < indices_->size (); ++idx)
189 if (this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0)
191 output.
points (idx, 0) = std::numeric_limits<float>::quiet_NaN ();
202 output.
points (idx, 0) = this->
isBoundaryPoint (*surface_, input_->points[(*indices_)[idx]], nn_indices, u, v, angle_threshold_);
208 for (
size_t idx = 0; idx < indices_->size (); ++idx)
210 if (!
isFinite ((*input_)[(*indices_)[idx]]) ||
211 this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0)
213 output.
points (idx, 0) = std::numeric_limits<float>::quiet_NaN ();
224 output.
points (idx, 0) = this->
isBoundaryPoint (*surface_, input_->points[(*indices_)[idx]], nn_indices, u, v, angle_threshold_);
229 #define PCL_INSTANTIATE_BoundaryEstimation(PointInT,PointNT,PointOutT) template class PCL_EXPORTS pcl::BoundaryEstimation<PointInT, PointNT, PointOutT>;
231 #endif // PCL_FEATURES_IMPL_BOUNDARY_H_