Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef PCL_FEATURES_IMPL_NORMAL_3D_H_
00042 #define PCL_FEATURES_IMPL_NORMAL_3D_H_
00043
00044 #include <pcl/features/normal_3d.h>
00045
00047 template <typename PointInT, typename PointOutT> void
00048 pcl::NormalEstimation<PointInT, PointOutT>::computeFeature (PointCloudOut &output)
00049 {
00050
00051
00052 std::vector<int> nn_indices (k_);
00053 std::vector<float> nn_dists (k_);
00054
00055 output.is_dense = true;
00056
00057 if (input_->is_dense)
00058 {
00059
00060 for (size_t idx = 0; idx < indices_->size (); ++idx)
00061 {
00062 if (this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0)
00063 {
00064 output.points[idx].normal[0] = output.points[idx].normal[1] = output.points[idx].normal[2] = output.points[idx].curvature = std::numeric_limits<float>::quiet_NaN ();
00065
00066 output.is_dense = false;
00067 continue;
00068 }
00069
00070 computePointNormal (*surface_, nn_indices,
00071 output.points[idx].normal[0], output.points[idx].normal[1], output.points[idx].normal[2], output.points[idx].curvature);
00072
00073 flipNormalTowardsViewpoint (input_->points[(*indices_)[idx]], vpx_, vpy_, vpz_,
00074 output.points[idx].normal[0], output.points[idx].normal[1], output.points[idx].normal[2]);
00075
00076 }
00077 }
00078 else
00079 {
00080
00081 for (size_t idx = 0; idx < indices_->size (); ++idx)
00082 {
00083 if (!isFinite ((*input_)[(*indices_)[idx]]) ||
00084 this->searchForNeighbors ((*indices_)[idx], search_parameter_, nn_indices, nn_dists) == 0)
00085 {
00086 output.points[idx].normal[0] = output.points[idx].normal[1] = output.points[idx].normal[2] = output.points[idx].curvature = std::numeric_limits<float>::quiet_NaN ();
00087
00088 output.is_dense = false;
00089 continue;
00090 }
00091
00092 computePointNormal (*surface_, nn_indices,
00093 output.points[idx].normal[0], output.points[idx].normal[1], output.points[idx].normal[2], output.points[idx].curvature);
00094
00095 flipNormalTowardsViewpoint (input_->points[(*indices_)[idx]], vpx_, vpy_, vpz_,
00096 output.points[idx].normal[0], output.points[idx].normal[1], output.points[idx].normal[2]);
00097
00098 }
00099 }
00100 }
00101
00102 #define PCL_INSTANTIATE_NormalEstimation(T,NT) template class PCL_EXPORTS pcl::NormalEstimation<T,NT>;
00103
00104 #endif // PCL_FEATURES_IMPL_NORMAL_3D_H_